Prepara l'architettura multi-nodo (MediaMTX+ffmpeg) con assignment URL per sessione, admin di provision/drain e provider Cloud/DNS astratti verso mltv-stream.net. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.4 KiB
Ruby
38 lines
1.4 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
|
|
end
|