MCPcopy Index your code
hub / github.com/coder/coder / TestWorkspaceProxyWorkspaceApps

Function TestWorkspaceProxyWorkspaceApps

enterprise/wsproxy/wsproxy_test.go:868–948  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

866}
867
868func TestWorkspaceProxyWorkspaceApps(t *testing.T) {
869 t.Parallel()
870
871 apptest.Run(t, false, func(t *testing.T, opts *apptest.DeploymentOptions) *apptest.Deployment {
872 deploymentValues := coderdtest.DeploymentValues(t)
873 deploymentValues.DisablePathApps = serpent.Bool(opts.DisablePathApps)
874 deploymentValues.Dangerous.AllowPathAppSharing = serpent.Bool(opts.DangerousAllowPathAppSharing)
875 deploymentValues.Dangerous.AllowPathAppSiteOwnerAccess = serpent.Bool(opts.DangerousAllowPathAppSiteOwnerAccess)
876 deploymentValues.Experiments = []string{
877 "*",
878 }
879
880 proxyStatsCollectorFlushCh := make(chan chan<- struct{}, 1)
881 flushStats := func() {
882 proxyStatsCollectorFlushDone := make(chan struct{}, 1)
883 proxyStatsCollectorFlushCh <- proxyStatsCollectorFlushDone
884 <-proxyStatsCollectorFlushDone
885 }
886
887 if opts.PrimaryAppHost == "" {
888 opts.PrimaryAppHost = "*.primary.test.coder.com"
889 }
890
891 db, pubsub := dbtestutil.NewDB(t)
892
893 client, closer, api, user := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
894 Options: &coderdtest.Options{
895 DeploymentValues: deploymentValues,
896 AppHostname: opts.PrimaryAppHost,
897 IncludeProvisionerDaemon: true,
898 RealIPConfig: &httpmw.RealIPConfig{
899 TrustedOrigins: []*net.IPNet{{
900 IP: net.ParseIP("127.0.0.1"),
901 Mask: net.CIDRMask(8, 32),
902 }},
903 TrustedHeaders: []string{
904 "CF-Connecting-IP",
905 },
906 },
907 WorkspaceAppsStatsCollectorOptions: opts.StatsCollectorOptions,
908 Database: db,
909 Pubsub: pubsub,
910 },
911 LicenseOptions: &coderdenttest.LicenseOptions{
912 Features: license.Features{
913 codersdk.FeatureWorkspaceProxy: 1,
914 codersdk.FeatureMultipleOrganizations: 1,
915 },
916 },
917 })
918 t.Cleanup(func() {
919 _ = closer.Close()
920 })
921
922 _ = dbgen.CryptoKey(t, db, database.CryptoKey{
923 Feature: database.CryptoKeyFeatureWorkspaceAppsToken,
924 })
925 _ = dbgen.CryptoKey(t, db, database.CryptoKey{

Callers

nothing calls this directly

Calls 8

RunFunction · 0.92
DeploymentValuesFunction · 0.92
NewDBFunction · 0.92
NewWithAPIFunction · 0.92
CryptoKeyFunction · 0.92
NewWorkspaceProxyReplicaFunction · 0.92
CleanupMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected