(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func TestWorkspaceApps(t *testing.T) { |
| 18 | t.Parallel() |
| 19 | |
| 20 | apptest.Run(t, true, func(t *testing.T, opts *apptest.DeploymentOptions) *apptest.Deployment { |
| 21 | deploymentValues := coderdtest.DeploymentValues(t) |
| 22 | deploymentValues.DisablePathApps = serpent.Bool(opts.DisablePathApps) |
| 23 | deploymentValues.Dangerous.AllowPathAppSharing = serpent.Bool(opts.DangerousAllowPathAppSharing) |
| 24 | deploymentValues.Dangerous.AllowPathAppSiteOwnerAccess = serpent.Bool(opts.DangerousAllowPathAppSiteOwnerAccess) |
| 25 | deploymentValues.Experiments = []string{ |
| 26 | "*", |
| 27 | } |
| 28 | |
| 29 | if opts.DisableSubdomainApps { |
| 30 | opts.AppHost = "" |
| 31 | } |
| 32 | |
| 33 | flushStatsCollectorCh := make(chan chan<- struct{}, 1) |
| 34 | opts.StatsCollectorOptions.Flush = flushStatsCollectorCh |
| 35 | flushStats := func() { |
| 36 | flushStatsCollectorDone := make(chan struct{}, 1) |
| 37 | flushStatsCollectorCh <- flushStatsCollectorDone |
| 38 | <-flushStatsCollectorDone |
| 39 | } |
| 40 | |
| 41 | db, pubsub := dbtestutil.NewDB(t) |
| 42 | |
| 43 | client, _, _, user := coderdenttest.NewWithAPI(t, &coderdenttest.Options{ |
| 44 | Options: &coderdtest.Options{ |
| 45 | DeploymentValues: deploymentValues, |
| 46 | AppHostname: opts.AppHost, |
| 47 | IncludeProvisionerDaemon: true, |
| 48 | RealIPConfig: &httpmw.RealIPConfig{ |
| 49 | TrustedOrigins: []*net.IPNet{{ |
| 50 | IP: net.ParseIP("127.0.0.1"), |
| 51 | Mask: net.CIDRMask(8, 32), |
| 52 | }}, |
| 53 | TrustedHeaders: []string{ |
| 54 | "CF-Connecting-IP", |
| 55 | }, |
| 56 | }, |
| 57 | WorkspaceAppsStatsCollectorOptions: opts.StatsCollectorOptions, |
| 58 | Database: db, |
| 59 | Pubsub: pubsub, |
| 60 | }, |
| 61 | LicenseOptions: &coderdenttest.LicenseOptions{ |
| 62 | Features: license.Features{ |
| 63 | codersdk.FeatureMultipleOrganizations: 1, |
| 64 | }, |
| 65 | }, |
| 66 | }) |
| 67 | |
| 68 | return &apptest.Deployment{ |
| 69 | Options: opts, |
| 70 | SDKClient: client, |
| 71 | FirstUser: user, |
| 72 | PathAppBaseURL: client.URL, |
| 73 | FlushStats: flushStats, |
| 74 | } |
nothing calls this directly
no test coverage detected