@@ -7,21 +7,20 @@ import (
77 "time"
88
99 "github.com/bytedance/sonic"
10- "github.com/google/uuid"
1110 "github.com/stretchr/testify/assert"
1211)
1312
1413var (
15- testWorkspaceID = uuid . New ()
16- testNow = types .Rfc3339Timestamp (time .Now ())
14+ testWorkspaceIDs = [] string { "00000000-0000-0000-0000-000000000001" , "00000000-0000-0000-0000-000000000002" }
15+ testNow = types .Rfc3339Timestamp (time .Now ())
1716)
1817
1918func TestAdvisoryUpdateEventMarshal (t * testing.T ) {
2019 event := AdvisoryUpdateEvent {
21- RhAccountID : 1 ,
22- WorkspaceID : testWorkspaceID ,
23- AdvisoryIDs : []int64 {101 , 202 , 303 },
24- ProducedAt : testNow ,
20+ RhAccountID : 1 ,
21+ WorkspaceIDs : testWorkspaceIDs ,
22+ AdvisoryIDs : []int64 {101 , 202 , 303 },
23+ ProducedAt : testNow ,
2524 }
2625
2726 data , err := sonic .Marshal (& event )
@@ -31,7 +30,7 @@ func TestAdvisoryUpdateEventMarshal(t *testing.T) {
3130 err = sonic .Unmarshal (data , & parsed )
3231 assert .NoError (t , err )
3332 assert .Equal (t , event .RhAccountID , parsed .RhAccountID )
34- assert .Equal (t , event .WorkspaceID , parsed .WorkspaceID )
33+ assert .Equal (t , event .WorkspaceIDs , parsed .WorkspaceIDs )
3534 assert .Equal (t , event .AdvisoryIDs , parsed .AdvisoryIDs )
3635 assert .NotNil (t , parsed .ProducedAt )
3736}
@@ -41,16 +40,16 @@ func TestAdvisoryUpdateEventsWriteEvents(t *testing.T) {
4140
4241 events := AdvisoryUpdateEvents {
4342 {
44- RhAccountID : 1 ,
45- WorkspaceID : testWorkspaceID ,
46- AdvisoryIDs : []int64 {100 , 200 },
47- ProducedAt : testNow ,
43+ RhAccountID : 1 ,
44+ WorkspaceIDs : testWorkspaceIDs ,
45+ AdvisoryIDs : []int64 {100 , 200 },
46+ ProducedAt : testNow ,
4847 },
4948 {
50- RhAccountID : 2 ,
51- WorkspaceID : testWorkspaceID ,
52- AdvisoryIDs : []int64 {300 },
53- ProducedAt : testNow ,
49+ RhAccountID : 2 ,
50+ WorkspaceIDs : testWorkspaceIDs ,
51+ AdvisoryIDs : []int64 {300 },
52+ ProducedAt : testNow ,
5453 },
5554 }
5655
@@ -64,15 +63,15 @@ func TestAdvisoryUpdateEventsWriteEvents(t *testing.T) {
6463 err = sonic .Unmarshal (mockWriter .Messages [0 ].Value , & firstEvent )
6564 assert .NoError (t , err )
6665 assert .Equal (t , events [0 ].RhAccountID , firstEvent .RhAccountID )
67- assert .Equal (t , events [0 ].WorkspaceID , firstEvent .WorkspaceID )
66+ assert .Equal (t , events [0 ].WorkspaceIDs , firstEvent .WorkspaceIDs )
6867 assert .Equal (t , events [0 ].AdvisoryIDs , firstEvent .AdvisoryIDs )
6968 assert .NotNil (t , firstEvent .ProducedAt )
7069
7170 var secondEvent AdvisoryUpdateEvent
7271 err = sonic .Unmarshal (mockWriter .Messages [1 ].Value , & secondEvent )
7372 assert .NoError (t , err )
7473 assert .Equal (t , events [1 ].RhAccountID , secondEvent .RhAccountID )
75- assert .Equal (t , events [1 ].WorkspaceID , secondEvent .WorkspaceID )
74+ assert .Equal (t , events [1 ].WorkspaceIDs , secondEvent .WorkspaceIDs )
7675 assert .Equal (t , events [1 ].AdvisoryIDs , secondEvent .AdvisoryIDs )
7776 assert .NotNil (t , secondEvent .ProducedAt )
7877}
0 commit comments