...
1 package integration_test
2
3 import (
4 "edge-infra.dev/pkg/edge/api/graph/model"
5 "edge-infra.dev/pkg/edge/constants/api/cluster"
6 "edge-infra.dev/pkg/edge/constants/api/fleet"
7 "edge-infra.dev/test/framework/integration"
8 )
9
10 func (s *Suite) TestRegisterClusterFlow() {
11 integration.SkipIf(s.Framework)
12 maxNodes := 3
13 minNodes := 1
14 createSite := true
15 var registrationResponse struct{ RegisterCluster *model.RegistrationResponse }
16 registrationMutation := registerClusterMutation(&model.RegistrationPayload{
17 Name: "test-cluster-registration-flow",
18 Fleet: fleet.Store,
19 ClusterType: cluster.GKE,
20 StoreInfo: &model.StoreInfo{
21 StoreID: &testStoreID,
22 CreateSite: &createSite,
23 },
24 BannerName: testOrg,
25 ClusterInfo: &model.ClusterInfo{
26 Location: testLocation,
27 NodeVersion: &testClusterVersion,
28 MachineType: testClusterMachineType,
29 NumNodes: testClusterNumNodes,
30 Autoscale: true,
31 MaxNodes: &maxNodes,
32 MinNodes: &minNodes,
33 },
34 })
35 err := ResolverClient.Post(registrationMutation, ®istrationResponse)
36 s.NoError(err)
37 s.NotEmpty(registrationResponse)
38
39 var bootstrapResponse struct{ BootstrapCluster *model.BootstrapResponse }
40 bootstrapMutation := bootstrapClusterMutation(&model.BootstrapPayload{
41 ClusterEdgeID: registrationResponse.RegisterCluster.ClusterEdgeID,
42 })
43 ResolverClient.MustPost(bootstrapMutation, &bootstrapResponse)
44 s.NotNil(bootstrapResponse.BootstrapCluster)
45 s.NotEmpty(bootstrapResponse.BootstrapCluster.ProjectID)
46 s.NotEmpty(bootstrapResponse.BootstrapCluster.Secrets)
47 s.NotEmpty(bootstrapResponse.BootstrapCluster.FluxConfig)
48 s.Equal(1, len(bootstrapResponse.BootstrapCluster.FluxConfig.FluxKustomize))
49 s.Equal(1, len(bootstrapResponse.BootstrapCluster.FluxConfig.FluxBucket))
50 }
51
View as plain text