From 94e9c4384e69bd2cf0b5a7cc3f83e83ed6433977 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Fri, 10 Mar 2023 16:53:31 +0000 Subject: [PATCH] chore: add a test to ensure audit code works with AGPL Fixes the regression seen in v0.19.1. --- enterprise/coderd/coderd_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/enterprise/coderd/coderd_test.go b/enterprise/coderd/coderd_test.go index 44de1d806fd06..74e41cfa4618b 100644 --- a/enterprise/coderd/coderd_test.go +++ b/enterprise/coderd/coderd_test.go @@ -204,6 +204,27 @@ func TestAuditLogging(t *testing.T) { t.Logf("%T = %T", auditor, ea) assert.Equal(t, reflect.ValueOf(ea).Type(), reflect.ValueOf(auditor).Type()) }) + // The AGPL code runs with a fake auditor that doesn't represent the real implementation. + // We do a simple test to ensure that basic flows function. + t.Run("FullBuild", func(t *testing.T) { + t.Parallel() + ctx, cancelFunc := testutil.Context(t) + defer cancelFunc() + client := coderdenttest.New(t, &coderdenttest.Options{ + Options: &coderdtest.Options{ + IncludeProvisionerDaemon: true, + }, + }) + user := coderdtest.CreateFirstUser(t, client) + workspace, agent := setupWorkspaceAgent(t, client, user, 0) + conn, err := client.DialWorkspaceAgent(ctx, agent.ID, nil) + require.NoError(t, err) + defer conn.Close() + connected := conn.AwaitReachable(ctx) + require.True(t, connected) + build := coderdtest.CreateWorkspaceBuild(t, client, workspace, database.WorkspaceTransitionStop) + coderdtest.AwaitWorkspaceBuildJob(t, client, build.ID) + }) } // testDBAuthzRole returns a context with a subject that has a role