Skip to content

Commit

Permalink
deactivate snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoSchw committed Mar 24, 2024
1 parent 17ba8a0 commit 55f8fda
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 102 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Test with Go
run: make test-git
- name: Upload Go test results
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v4
with:
name: Go-results
path: TestResults.json
203 changes: 103 additions & 100 deletions internal/rtp/sdp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rtp
import (
"testing"

"github.com/bradleyjkemp/cupaloy/v2"
"github.com/google/uuid"
"github.com/pion/webrtc/v3"
"github.com/stretchr/testify/assert"
Expand All @@ -22,106 +23,108 @@ func TestSDP(t *testing.T) {
assert.Equal(t, 0, repo.Len())
})

//t.Run("Read not changed offer sdp", func(t *testing.T) {
// repo := newTrackSdpInfoRepository()
// err := getIngressTrackSdpInfo(webrtc.SessionDescription{
// Type: webrtc.SDPTypeOffer,
// SDP: sdpOfferString,
// }, uuid.New(), repo)
// assert.NoError(t, err)
// assert.Equal(t, 2, repo.Len())
// audio, hasAudio := repo.getSdpInfoByIngressTrackId("359bc90f-bc4c-47a7-b283-30e88abc2374")
// assert.True(t, hasAudio)
// assert.Equal(t, PurposeGuest, audio.Purpose)
// assert.Equal(t, true, audio.Mute)
// assert.Equal(t, "Guest-Audio", audio.Info)
// assert.Equal(t, "359bc90f-bc4c-47a7-b283-30e88abc2374", audio.IngressTrackId)
// video, hasVideo := repo.getSdpInfoByIngressTrackId("2e86a7ac-b7e9-470f-9c53-6160e468e658")
// assert.True(t, hasVideo)
// assert.Equal(t, PurposeGuest, video.Purpose)
// assert.Equal(t, false, video.Mute)
// assert.Equal(t, "Guest-Video", video.Info)
// assert.Equal(t, "2e86a7ac-b7e9-470f-9c53-6160e468e658", video.IngressTrackId)
//})
//
//t.Run("Read Firefox not changed offer sdp", func(t *testing.T) {
// repo := newTrackSdpInfoRepository()
// err := getIngressTrackSdpInfo(webrtc.SessionDescription{
// Type: webrtc.SDPTypeOffer,
// SDP: sdpFirefoxOfferString,
// }, uuid.New(), repo)
// assert.NoError(t, err)
// assert.Equal(t, 2, repo.Len())
// audio, hasAudio := repo.getSdpInfoByIngressTrackId("{fa595b2c-ba3a-4cd9-93b8-91c20b8af758}")
// assert.True(t, hasAudio)
// assert.Equal(t, PurposeGuest, audio.Purpose)
// assert.Equal(t, true, audio.Mute)
// assert.Equal(t, "Guest-Audio", audio.Info)
// assert.Equal(t, "{fa595b2c-ba3a-4cd9-93b8-91c20b8af758}", audio.IngressTrackId)
// video, hasVideo := repo.getSdpInfoByIngressTrackId("{397dc6f7-76cc-4044-9a12-15cb433b99fc}")
// assert.True(t, hasVideo)
// assert.Equal(t, PurposeGuest, video.Purpose)
// assert.Equal(t, false, video.Mute)
// assert.Equal(t, "Guest-Video", video.Info)
// assert.Equal(t, "{397dc6f7-76cc-4044-9a12-15cb433b99fc}", video.IngressTrackId)
//})
//
//t.Run("Read live stream from offer sdp", func(t *testing.T) {
// repo := newTrackSdpInfoRepository()
// err := getIngressTrackSdpInfo(webrtc.SessionDescription{
// Type: webrtc.SDPTypeOffer,
// SDP: sdpOfferWithLiveStream,
// }, uuid.New(), repo)
// assert.NoError(t, err)
// assert.Equal(t, 4, repo.Len())
// audio, hasAudio := repo.getSdpInfoByIngressTrackId("57e34f3b-e41d-4dd1-94ef-a5db7d13ca53")
// assert.True(t, hasAudio)
// assert.Equal(t, PurposeGuest, audio.Purpose)
// assert.Equal(t, false, audio.Mute)
// assert.Equal(t, "Guest-Audio", audio.Info)
// assert.Equal(t, "57e34f3b-e41d-4dd1-94ef-a5db7d13ca53", audio.IngressTrackId)
// video, hasVideo := repo.getSdpInfoByIngressTrackId("5dacbd5d-f234-4496-923a-c5c188ee9424")
// assert.True(t, hasVideo)
// assert.Equal(t, PurposeGuest, video.Purpose)
// assert.Equal(t, false, video.Mute)
// assert.Equal(t, "Guest-Video", video.Info)
// assert.Equal(t, "5dacbd5d-f234-4496-923a-c5c188ee9424", video.IngressTrackId)
// liveAudio, hasLiveAudio := repo.getSdpInfoByIngressTrackId("a9345edd-5648-4d78-81be-02e0114adbcd")
// assert.True(t, hasLiveAudio)
// assert.Equal(t, PurposeMain, liveAudio.Purpose)
// assert.Equal(t, true, liveAudio.Mute)
// assert.Equal(t, "Main-Audio", liveAudio.Info)
// assert.Equal(t, "a9345edd-5648-4d78-81be-02e0114adbcd", liveAudio.IngressTrackId)
// liveVideo, hasLiveVideo := repo.getSdpInfoByIngressTrackId("a0a03556-3aff-4684-b3ab-59c7bf4cb4bc")
// assert.True(t, hasLiveVideo)
// assert.Equal(t, PurposeMain, liveVideo.Purpose)
// assert.Equal(t, true, liveVideo.Mute)
// assert.Equal(t, "Main-Video", liveVideo.Info)
// assert.Equal(t, "a0a03556-3aff-4684-b3ab-59c7bf4cb4bc", liveVideo.IngressTrackId)
//})
//
//t.Run("set stream as main stream", func(t *testing.T) {
// streamID := "b9a4ca87-1c7b-40a3-9400-a6012c725faa"
// offer := &webrtc.SessionDescription{
// Type: webrtc.SDPTypeOffer,
// SDP: pionSdpOfferWithoutLiveStream,
// }
// newOffer, err := MarkStreamAsMain(offer, streamID)
//
// cupaloy.SnapshotT(t, newOffer.SDP)
// assert.NoError(t, err)
//})
//
//t.Run("munge offer with track info list", func(t *testing.T) {
// repo := testTrackInfoRepositorySetup(t)
// offer := &webrtc.SessionDescription{
// Type: webrtc.SDPTypeOffer,
// SDP: pionOfferWithSecsMedia,
// }
// newOffer, err := setEgressTrackInfo(offer, repo)
// assert.NoError(t, err)
// cupaloy.SnapshotT(t, newOffer.SDP)
//})
t.Run("Read not changed offer sdp", func(t *testing.T) {
repo := newTrackSdpInfoRepository()
err := getIngressTrackSdpInfo(webrtc.SessionDescription{
Type: webrtc.SDPTypeOffer,
SDP: sdpOfferString,
}, uuid.New(), repo)
assert.NoError(t, err)
assert.Equal(t, 2, repo.Len())
audio, hasAudio := repo.getSdpInfoByIngressTrackId("359bc90f-bc4c-47a7-b283-30e88abc2374")
assert.True(t, hasAudio)
assert.Equal(t, PurposeGuest, audio.Purpose)
assert.Equal(t, true, audio.Mute)
assert.Equal(t, "Guest-Audio", audio.Info)
assert.Equal(t, "359bc90f-bc4c-47a7-b283-30e88abc2374", audio.IngressTrackId)
video, hasVideo := repo.getSdpInfoByIngressTrackId("2e86a7ac-b7e9-470f-9c53-6160e468e658")
assert.True(t, hasVideo)
assert.Equal(t, PurposeGuest, video.Purpose)
assert.Equal(t, false, video.Mute)
assert.Equal(t, "Guest-Video", video.Info)
assert.Equal(t, "2e86a7ac-b7e9-470f-9c53-6160e468e658", video.IngressTrackId)
})

t.Run("Read Firefox not changed offer sdp", func(t *testing.T) {
repo := newTrackSdpInfoRepository()
err := getIngressTrackSdpInfo(webrtc.SessionDescription{
Type: webrtc.SDPTypeOffer,
SDP: sdpFirefoxOfferString,
}, uuid.New(), repo)
assert.NoError(t, err)
assert.Equal(t, 2, repo.Len())
audio, hasAudio := repo.getSdpInfoByIngressTrackId("{fa595b2c-ba3a-4cd9-93b8-91c20b8af758}")
assert.True(t, hasAudio)
assert.Equal(t, PurposeGuest, audio.Purpose)
assert.Equal(t, true, audio.Mute)
assert.Equal(t, "Guest-Audio", audio.Info)
assert.Equal(t, "{fa595b2c-ba3a-4cd9-93b8-91c20b8af758}", audio.IngressTrackId)
video, hasVideo := repo.getSdpInfoByIngressTrackId("{397dc6f7-76cc-4044-9a12-15cb433b99fc}")
assert.True(t, hasVideo)
assert.Equal(t, PurposeGuest, video.Purpose)
assert.Equal(t, false, video.Mute)
assert.Equal(t, "Guest-Video", video.Info)
assert.Equal(t, "{397dc6f7-76cc-4044-9a12-15cb433b99fc}", video.IngressTrackId)
})

t.Run("Read live stream from offer sdp", func(t *testing.T) {
repo := newTrackSdpInfoRepository()
err := getIngressTrackSdpInfo(webrtc.SessionDescription{
Type: webrtc.SDPTypeOffer,
SDP: sdpOfferWithLiveStream,
}, uuid.New(), repo)
assert.NoError(t, err)
assert.Equal(t, 4, repo.Len())
audio, hasAudio := repo.getSdpInfoByIngressTrackId("57e34f3b-e41d-4dd1-94ef-a5db7d13ca53")
assert.True(t, hasAudio)
assert.Equal(t, PurposeGuest, audio.Purpose)
assert.Equal(t, false, audio.Mute)
assert.Equal(t, "Guest-Audio", audio.Info)
assert.Equal(t, "57e34f3b-e41d-4dd1-94ef-a5db7d13ca53", audio.IngressTrackId)
video, hasVideo := repo.getSdpInfoByIngressTrackId("5dacbd5d-f234-4496-923a-c5c188ee9424")
assert.True(t, hasVideo)
assert.Equal(t, PurposeGuest, video.Purpose)
assert.Equal(t, false, video.Mute)
assert.Equal(t, "Guest-Video", video.Info)
assert.Equal(t, "5dacbd5d-f234-4496-923a-c5c188ee9424", video.IngressTrackId)
liveAudio, hasLiveAudio := repo.getSdpInfoByIngressTrackId("a9345edd-5648-4d78-81be-02e0114adbcd")
assert.True(t, hasLiveAudio)
assert.Equal(t, PurposeMain, liveAudio.Purpose)
assert.Equal(t, true, liveAudio.Mute)
assert.Equal(t, "Main-Audio", liveAudio.Info)
assert.Equal(t, "a9345edd-5648-4d78-81be-02e0114adbcd", liveAudio.IngressTrackId)
liveVideo, hasLiveVideo := repo.getSdpInfoByIngressTrackId("a0a03556-3aff-4684-b3ab-59c7bf4cb4bc")
assert.True(t, hasLiveVideo)
assert.Equal(t, PurposeMain, liveVideo.Purpose)
assert.Equal(t, true, liveVideo.Mute)
assert.Equal(t, "Main-Video", liveVideo.Info)
assert.Equal(t, "a0a03556-3aff-4684-b3ab-59c7bf4cb4bc", liveVideo.IngressTrackId)
})

t.Run("set stream as main stream", func(t *testing.T) {
t.Skip("skipping testing")
streamID := "b9a4ca87-1c7b-40a3-9400-a6012c725faa"
offer := &webrtc.SessionDescription{
Type: webrtc.SDPTypeOffer,
SDP: pionSdpOfferWithoutLiveStream,
}
newOffer, err := MarkStreamAsMain(offer, streamID)

cupaloy.SnapshotT(t, newOffer.SDP)
assert.NoError(t, err)
})

t.Run("munge offer with track info list", func(t *testing.T) {
t.Skip("skipping testing")
repo := testTrackInfoRepositorySetup(t)
offer := &webrtc.SessionDescription{
Type: webrtc.SDPTypeOffer,
SDP: pionOfferWithSecsMedia,
}
newOffer, err := setEgressTrackInfo(offer, repo)
assert.NoError(t, err)
cupaloy.SnapshotT(t, newOffer.SDP)
})
}

func testTrackInfoRepositorySetup(t *testing.T) *trackSdpInfoRepository {
Expand Down

0 comments on commit 55f8fda

Please sign in to comment.