-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f278597
commit a25a7f0
Showing
5 changed files
with
20 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11266,56 +11266,3 @@ func Test_setEntitlementsWithLegacyLogic(t *testing.T) { | |
}) | ||
} | ||
} | ||
|
||
// TestGetClusterInfo tests the getClusterInfo handler. | ||
func TestGetClusterInfo(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
cloud bool | ||
assert func(t *testing.T, err error, statusCode int, resp GetClusterInfoResponse) | ||
}{ | ||
{ | ||
name: "cloud cluster", | ||
cloud: true, | ||
assert: func(t *testing.T, err error, statusCode int, resp GetClusterInfoResponse) { | ||
require.NoError(t, err) | ||
require.Equal(t, http.StatusOK, statusCode) | ||
require.True(t, resp.IsCloud) | ||
}, | ||
}, | ||
{ | ||
name: "non-cloud cluster", | ||
cloud: false, | ||
assert: func(t *testing.T, err error, statusCode int, resp GetClusterInfoResponse) { | ||
require.NoError(t, err) | ||
require.Equal(t, http.StatusOK, statusCode) | ||
require.False(t, resp.IsCloud) | ||
}, | ||
}, | ||
} | ||
|
||
// Iterate over test cases. | ||
for _, tc := range tests { | ||
t.Run(tc.name, func(t *testing.T) { | ||
modules.SetTestModules(t, &modules.TestModules{ | ||
TestFeatures: modules.Features{ | ||
Cloud: tc.cloud, | ||
}, | ||
}) | ||
|
||
env := newWebPack(t, 1) | ||
proxy := env.proxies[0] | ||
pack := proxy.authPack(t, "[email protected]", auth.GetPresetRoles()) | ||
endpoint := pack.clt.Endpoint("webapi", "sites", env.server.ClusterName(), "info") | ||
|
||
var clusterInfo GetClusterInfoResponse | ||
resp, reqErr := pack.clt.Get(context.Background(), endpoint, url.Values{}) | ||
if reqErr != nil && resp.Code() == http.StatusOK { | ||
err := json.Unmarshal(resp.Bytes(), &clusterInfo) | ||
require.NoError(t, err) | ||
} | ||
|
||
tc.assert(t, reqErr, resp.Code(), clusterInfo) | ||
}) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
web/packages/teleport/src/Clusters/ManageCluster/ManageCluster.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters