File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ func TestK8SReporter(t *testing.T) {
34
34
)
35
35
36
36
var (
37
- ctx , cancel = context .WithTimeout ( context . Background (), time . Second * 10 )
37
+ ctx = context .Background ()
38
38
39
39
expectedAgentID = uuid .New ()
40
40
expectedWorkspaceID = uuid .New ()
@@ -44,7 +44,6 @@ func TestK8SReporter(t *testing.T) {
44
44
jfrogClient = jfrog .NewMockClient (gomock .NewController (t ))
45
45
resultsCh = make (chan codersdk.JFrogXrayScan )
46
46
)
47
- defer cancel ()
48
47
49
48
jfrogClient .EXPECT ().ScanResults (jfrog.Image {
50
49
Repo : "my-repo" ,
@@ -118,11 +117,10 @@ func TestK8SReporter(t *testing.T) {
118
117
High : expectedHigh ,
119
118
Medium : expectedMedium ,
120
119
}
121
- var actualResult codersdk.JFrogXrayScan
122
120
select {
123
- case actualResult = <- resultsCh :
124
- case <- ctx .Done ():
121
+ case actualResult := <- resultsCh :
122
+ require .Equal (t , expectedResult , actualResult )
123
+ case <- time .After (time .Second * 10 ):
125
124
t .Fatalf ("ctx timed out waiting for result" )
126
125
}
127
- require .Equal (t , expectedResult , actualResult )
128
126
}
You can’t perform that action at this time.
0 commit comments