Così overflow Hetzner e VOD YouTube restano in archivio dopo lo spegnimento del nodo, e la colonna ingest non si svuota. Co-authored-by: Cursor <cursoragent@cursor.com>
69 lines
2.7 KiB
Ruby
69 lines
2.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
RSpec.describe StreamSession do
|
|
it "builds ingest/hls URLs from the assigned stream node" do
|
|
node = StreamNode.create!(
|
|
slug: "ingest-01",
|
|
hostname: "ingest-01.mltv-stream.net",
|
|
role: "cloud",
|
|
status: "ready",
|
|
provider: "hetzner",
|
|
rtmp_base_url: "rtmp://ingest-01.mltv-stream.net:1935",
|
|
hls_base_url: "https://ingest-01.mltv-stream.net/hls",
|
|
api_base_url: "http://10.0.0.2:9997",
|
|
internal_rtmp_url: "rtmp://10.0.0.2:1935",
|
|
max_publishers: 4,
|
|
max_relays: 4
|
|
)
|
|
user = User.create!(email: "s@example.com", name: "S", password: "Password123", role: "coach")
|
|
club = Club.create!(name: "Club", sport: "volleyball")
|
|
team = club.teams.create!(name: "Team", sport: "volleyball", slug: "team-url")
|
|
match = team.matches.create!(opponent_name: "Opp", scheduled_at: 1.hour.from_now)
|
|
session = StreamSession.create!(
|
|
match: match, user: user, platform: "matchlivetv", status: "idle", stream_node: node
|
|
)
|
|
|
|
expect(session.rtmp_ingest_url).to eq(
|
|
"rtmp://ingest-01.mltv-stream.net:1935/live/match_#{session.id}"
|
|
)
|
|
expect(session.hls_playback_url).to eq(
|
|
"https://ingest-01.mltv-stream.net/hls/live/match_#{session.id}/index.m3u8"
|
|
)
|
|
expect(session.mediamtx_api_base_url).to eq("http://10.0.0.2:9997")
|
|
expect(session.mediamtx_internal_rtmp_url).to eq("rtmp://10.0.0.2:1935")
|
|
end
|
|
|
|
it "keeps ingest snapshot after the stream node is destroyed" do
|
|
node = StreamNode.create!(
|
|
slug: "ingest-01",
|
|
hostname: "ingest-01.mltv-stream.net",
|
|
role: "cloud",
|
|
status: "ready",
|
|
provider: "hetzner",
|
|
rtmp_base_url: "rtmp://ingest-01.mltv-stream.net:1935",
|
|
hls_base_url: "https://ingest-01.mltv-stream.net/hls",
|
|
api_base_url: "http://10.0.0.2:9997",
|
|
internal_rtmp_url: "rtmp://10.0.0.2:1935",
|
|
max_publishers: 4,
|
|
max_relays: 4
|
|
)
|
|
user = User.create!(email: "snap@example.com", name: "S", password: "Password123", role: "coach")
|
|
club = Club.create!(name: "Club Snap", sport: "volleyball")
|
|
team = club.teams.create!(name: "Team", sport: "volleyball", slug: "team-snap")
|
|
match = team.matches.create!(opponent_name: "Opp", scheduled_at: 1.hour.from_now)
|
|
session = StreamSession.create!(
|
|
match: match, user: user, platform: "matchlivetv", status: "ended", stream_node: node
|
|
)
|
|
expect(session.ingest_slug).to eq("ingest-01")
|
|
expect(session.ingest_role).to eq("cloud")
|
|
|
|
node.destroy!
|
|
session.reload
|
|
expect(session.stream_node).to be_nil
|
|
expect(session.ingest_slug_display).to eq("ingest-01")
|
|
expect(session.ingest_role_display).to eq("cloud")
|
|
end
|
|
end
|