Skip to content

feat: add initial implementation #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update test
  • Loading branch information
sreya committed Jan 31, 2024
commit ed7c3c3fa6b6ffaaa8b5f2aab993fbacf885d463
10 changes: 4 additions & 6 deletions reporter/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestK8SReporter(t *testing.T) {
)

var (
ctx, cancel = context.WithTimeout(context.Background(), time.Second*10)
ctx = context.Background()

expectedAgentID = uuid.New()
expectedWorkspaceID = uuid.New()
Expand All @@ -44,7 +44,6 @@ func TestK8SReporter(t *testing.T) {
jfrogClient = jfrog.NewMockClient(gomock.NewController(t))
resultsCh = make(chan codersdk.JFrogXrayScan)
)
defer cancel()

jfrogClient.EXPECT().ScanResults(jfrog.Image{
Repo: "my-repo",
Expand Down Expand Up @@ -118,11 +117,10 @@ func TestK8SReporter(t *testing.T) {
High: expectedHigh,
Medium: expectedMedium,
}
var actualResult codersdk.JFrogXrayScan
select {
case actualResult = <-resultsCh:
case <-ctx.Done():
case actualResult := <-resultsCh:
require.Equal(t, expectedResult, actualResult)
case <-time.After(time.Second * 10):
t.Fatalf("ctx timed out waiting for result")
}
require.Equal(t, expectedResult, actualResult)
}