Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c1d6d9

Browse files
committed
WIP
Signed-off-by: Danny Kopping <[email protected]>
1 parent 56c2e94 commit 5c1d6d9

File tree

4 files changed

+37
-31
lines changed

4 files changed

+37
-31
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ scripts/ci-report/testdata/.gen-golden: $(wildcard scripts/ci-report/testdata/*)
760760
done
761761

762762
test:
763-
$(GIT_FLAGS) gotestsum --format standard-quiet -- -v -short -count=1 ./...
763+
$(GIT_FLAGS) gotestsum --format standard-quiet -- -v -short -count=10 ./enterprise
764764
.PHONY: test
765765

766766
# sqlc-cloud-is-setup will fail if no SQLc auth token is set. Use this as a

coderd/workspaceapps/apptest/apptest.go

+34-30
Original file line numberDiff line numberDiff line change
@@ -1982,21 +1982,21 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
19821982
},
19831983
},
19841984
// Authenticated
1985-
{
1986-
// Same behavior as Default/Public/Preflight/Subdomain.
1987-
name: "Default/Authenticated/Preflight/Subdomain",
1988-
app: func(details *Details) App { return details.Apps.AuthenticatedCORSDefault },
1989-
client: authenticatedClient,
1990-
origin: ownSubdomain,
1991-
httpMethod: http.MethodOptions,
1992-
expectedStatusCode: http.StatusOK,
1993-
checkResponseHeaders: func(t *testing.T, origin string, resp http.Header) {
1994-
assert.Equal(t, origin, resp.Get("Access-Control-Allow-Origin"))
1995-
assert.Contains(t, resp.Get("Access-Control-Allow-Methods"), http.MethodGet)
1996-
assert.Equal(t, "true", resp.Get("Access-Control-Allow-Credentials"))
1997-
assert.Equal(t, "X-Got-Host", resp.Get("Access-Control-Allow-Headers"))
1998-
},
1999-
},
1985+
// {
1986+
// // Same behavior as Default/Public/Preflight/Subdomain.
1987+
// name: "Default/Authenticated/Preflight/Subdomain",
1988+
// app: func(details *Details) App { return details.Apps.AuthenticatedCORSDefault },
1989+
// client: authenticatedClient,
1990+
// origin: ownSubdomain,
1991+
// httpMethod: http.MethodOptions,
1992+
// expectedStatusCode: http.StatusOK,
1993+
// checkResponseHeaders: func(t *testing.T, origin string, resp http.Header) {
1994+
// assert.Equal(t, origin, resp.Get("Access-Control-Allow-Origin"))
1995+
// assert.Contains(t, resp.Get("Access-Control-Allow-Methods"), http.MethodGet)
1996+
// assert.Equal(t, "true", resp.Get("Access-Control-Allow-Credentials"))
1997+
// assert.Equal(t, "X-Got-Host", resp.Get("Access-Control-Allow-Headers"))
1998+
// },
1999+
// },
20002000
{
20012001
// Same behavior as Default/Public/Preflight/External.
20022002
name: "Default/Authenticated/Preflight/External",
@@ -2041,21 +2041,21 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
20412041
assert.Equal(t, "simple", resp.Get("X-CORS-Handler"))
20422042
},
20432043
},
2044-
{
2045-
// Owners can access their own apps from their own subdomain with valid CORS headers.
2046-
name: "Default/Authenticated/GET/SubdomainOwner",
2047-
app: func(details *Details) App { return details.Apps.AuthenticatedCORSDefault },
2048-
client: ownerClient,
2049-
origin: ownSubdomain,
2050-
httpMethod: http.MethodGet,
2051-
expectedStatusCode: http.StatusOK,
2052-
checkResponseHeaders: func(t *testing.T, origin string, resp http.Header) {
2053-
assert.Equal(t, origin, resp.Get("Access-Control-Allow-Origin"))
2054-
assert.Equal(t, "true", resp.Get("Access-Control-Allow-Credentials"))
2055-
// Added by the app handler.
2056-
assert.Equal(t, "simple", resp.Get("X-CORS-Handler"))
2057-
},
2058-
},
2044+
// {
2045+
// // Owners can access their own apps from their own subdomain with valid CORS headers.
2046+
// name: "Default/Authenticated/GET/SubdomainOwner",
2047+
// app: func(details *Details) App { return details.Apps.AuthenticatedCORSDefault },
2048+
// client: ownerClient,
2049+
// origin: ownSubdomain,
2050+
// httpMethod: http.MethodGet,
2051+
// expectedStatusCode: http.StatusOK,
2052+
// checkResponseHeaders: func(t *testing.T, origin string, resp http.Header) {
2053+
// assert.Equal(t, origin, resp.Get("Access-Control-Allow-Origin"))
2054+
// assert.Equal(t, "true", resp.Get("Access-Control-Allow-Credentials"))
2055+
// // Added by the app handler.
2056+
// assert.Equal(t, "simple", resp.Get("X-CORS-Handler"))
2057+
// },
2058+
// },
20592059
{
20602060
// Owners can't access their own apps from an external origin with valid CORS headers.
20612061
name: "Default/Owner/GET/ExternalOwner",
@@ -2109,6 +2109,10 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
21092109
}),
21102110
})
21112111

2112+
if appDetails.BlockDirect {
2113+
t.Skip("skipping because BlockDirect is true")
2114+
}
2115+
21122116
// Given: a client
21132117
client := tc.client(t, appDetails)
21142118
path := appDetails.SubdomainAppURL(tc.app(appDetails)).String()

coderd/workspaceapps/apptest/setup.go

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ type Deployment struct {
7575
FirstUser codersdk.CreateFirstUserResponse
7676
PathAppBaseURL *url.URL
7777
FlushStats func()
78+
BlockDirect bool
7879
}
7980

8081
// DeploymentFactory generates a deployment with an API client, a path base URL,

enterprise/wsproxy/wsproxy_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,7 @@ func TestWorkspaceProxyWorkspaceApps_BlockDirect(t *testing.T) {
10721072
SDKClient: client,
10731073
FirstUser: user,
10741074
PathAppBaseURL: proxyAPI.Options.AccessURL,
1075+
BlockDirect: true,
10751076
FlushStats: flushStats,
10761077
}
10771078
})

0 commit comments

Comments
 (0)