package coderd_test import ( "context" "testing" "github.com/stretchr/testify/require" "go.uber.org/goleak" "github.com/coder/coder/buildinfo" "github.com/coder/coder/coderd/coderdtest" "github.com/coder/coder/testutil" ) func TestMain(m *testing.M) { goleak.VerifyTestMain(m) } func TestBuildInfo(t *testing.T) { t.Parallel() client := coderdtest.New(t, nil) ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() buildInfo, err := client.BuildInfo(ctx) require.NoError(t, err) require.Equal(t, buildinfo.ExternalURL(), buildInfo.ExternalURL, "external URL") require.Equal(t, buildinfo.Version(), buildInfo.Version, "version") } // TestAuthorizeAllEndpoints will check `authorize` is called on every endpoint registered. func TestAuthorizeAllEndpoints(t *testing.T) { t.Parallel() ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) defer cancel() a := coderdtest.NewAuthTester(ctx, t, nil) skipRoutes, assertRoute := coderdtest.AGPLRoutes(a) a.Test(ctx, assertRoute, skipRoutes) }