Skip to content

Commit ca278b9

Browse files
Merge branch 'master' into total_node_count_defaults
2 parents bf957ea + b96eda3 commit ca278b9

File tree

16 files changed

+1134
-503
lines changed

16 files changed

+1134
-503
lines changed

build/int.cloudbuild.yaml

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,26 @@ steps:
4646
- verify disable-client-cert
4747
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
4848
args: ['/bin/bash', '-c', 'cft test run TestDisableClientCert --stage teardown --verbose --test-dir test/integration']
49-
- id: converge shared-vpc-local
49+
- id: init shared-vpc-local
5050
waitFor:
5151
- create all
5252
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
53-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge shared-vpc-local']
53+
args: ['/bin/bash', '-c', 'cft test run TestSharedVPC --stage init --verbose --test-dir test/integration']
54+
- id: apply shared-vpc-local
55+
waitFor:
56+
- init shared-vpc-local
57+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
58+
args: ['/bin/bash', '-c', 'cft test run TestSharedVPC --stage apply --verbose --test-dir test/integration']
5459
- id: verify shared-vpc-local
5560
waitFor:
56-
- converge shared-vpc-local
61+
- apply shared-vpc-local
5762
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
58-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify shared-vpc-local']
63+
args: ['/bin/bash', '-c', 'cft test run TestSharedVPC --stage verify --verbose --test-dir test/integration']
5964
- id: destroy shared-vpc-local
6065
waitFor:
6166
- verify shared-vpc-local
6267
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
63-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy shared-vpc-local']
68+
args: ['/bin/bash', '-c', 'cft test run TestSharedVPC --stage teardown --verbose --test-dir test/integration']
6469
- id: init safer-cluster-local
6570
waitFor:
6671
- create all
@@ -81,21 +86,26 @@ steps:
8186
- verify safer-cluster-local
8287
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
8388
args: ['/bin/bash', '-c', 'cft test run TestSaferCluster --stage destroy --verbose']
84-
- id: converge simple-regional-local
89+
- id: init simple-regional-local
8590
waitFor:
8691
- create all
8792
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
88-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge simple-regional-local']
93+
args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage init --verbose']
94+
- id: apply simple-regional-local
95+
waitFor:
96+
- init simple-regional-local
97+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
98+
args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage apply --verbose']
8999
- id: verify simple-regional-local
90100
waitFor:
91-
- converge simple-regional-local
101+
- apply simple-regional-local
92102
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
93-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify simple-regional-local']
103+
args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage verify --verbose']
94104
- id: destroy simple-regional-local
95105
waitFor:
96-
- verify simple-regional-local
106+
- apply simple-regional-local
97107
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
98-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-regional-local']
108+
args: ['/bin/bash', '-c', 'cft test run TestSimpleRegional --stage teardown --verbose']
99109
- id: converge simple-regional-private-local
100110
waitFor:
101111
- create all
@@ -381,36 +391,46 @@ steps:
381391
- verify simple-zonal-with-asm-local
382392
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
383393
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-zonal-with-asm-local']
384-
- id: converge simple-autopilot-private-local
394+
- id: init simple-autopilot-private-local
385395
waitFor:
386396
- create all
387397
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
388-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge simple-autopilot-private-local']
398+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPrivate --stage init --verbose']
399+
- id: apply simple-autopilot-private-local
400+
waitFor:
401+
- init simple-autopilot-private-local
402+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
403+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPrivate --stage apply --verbose']
389404
- id: verify simple-autopilot-private-local
390405
waitFor:
391-
- converge simple-autopilot-private-local
406+
- apply simple-autopilot-private-local
392407
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
393-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify simple-autopilot-private-local']
408+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPrivate --stage verify --verbose']
394409
- id: destroy simple-autopilot-private-local
395410
waitFor:
396-
- verify simple-autopilot-private-local
411+
- apply simple-autopilot-private-local
397412
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
398-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-autopilot-private-local']
399-
- id: converge simple-autopilot-public-local
413+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPrivate --stage teardown --verbose']
414+
- id: init simple-autopilot-public-local
400415
waitFor:
401416
- create all
402417
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
403-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge simple-autopilot-public-local']
418+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPublic --stage init --verbose']
419+
- id: apply simple-autopilot-public-local
420+
waitFor:
421+
- init simple-autopilot-public-local
422+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
423+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPublic --stage apply --verbose']
404424
- id: verify simple-autopilot-public-local
405425
waitFor:
406-
- converge simple-autopilot-public-local
426+
- apply simple-autopilot-public-local
407427
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
408-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify simple-autopilot-public-local']
428+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPublic --stage verify --verbose']
409429
- id: destroy simple-autopilot-public-local
410430
waitFor:
411431
- verify simple-autopilot-public-local
412432
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
413-
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-autopilot-public-local']
433+
args: ['/bin/bash', '-c', 'cft test run TestSimpleAutopilotPublic --stage teardown --verbose']
414434
- id: init private-zonal-with-networking
415435
waitFor:
416436
- prepare

test/integration/shared_vpc/controls/gcloud.rb

Lines changed: 0 additions & 39 deletions
This file was deleted.

test/integration/shared_vpc/inspec.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
package shared_vpc
15+
16+
import (
17+
"testing"
18+
19+
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/gcloud"
20+
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
21+
"github.com/stretchr/testify/assert"
22+
)
23+
24+
func TestSharedVPC(t *testing.T) {
25+
bpt := tft.NewTFBlueprintTest(t)
26+
27+
bpt.DefineVerify(func(assert *assert.Assertions) {
28+
//Skipping Default Verify as the Verify Stage fails due to change in Client Cert Token
29+
// bpt.DefaultVerify(assert)
30+
31+
projectId := bpt.GetStringOutput("project_id")
32+
location := bpt.GetStringOutput("location")
33+
clusterName := bpt.GetStringOutput("cluster_name")
34+
35+
op := gcloud.Runf(t, "container clusters describe %s --zone %s --project %s", clusterName, location, projectId)
36+
assert.Contains(op.Get("status").String(), "RUNNING", "Cluster is Running")
37+
})
38+
39+
bpt.Test()
40+
}

test/integration/simple_autopilot_private/controls/gcloud.rb

Lines changed: 0 additions & 68 deletions
This file was deleted.

test/integration/simple_autopilot_private/inspec.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
package simple_autopilot_private
15+
16+
import (
17+
"testing"
18+
19+
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/gcloud"
20+
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/golden"
21+
"github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test/pkg/tft"
22+
"github.com/stretchr/testify/assert"
23+
)
24+
25+
func TestSimpleAutopilotPrivate(t *testing.T) {
26+
bpt := tft.NewTFBlueprintTest(t)
27+
28+
bpt.DefineVerify(func(assert *assert.Assertions) {
29+
//Skipping Default Verify as the Verify Stage fails due to change in Client Cert Token
30+
// bpt.DefaultVerify(assert)
31+
32+
projectId := bpt.GetStringOutput("project_id")
33+
location := bpt.GetStringOutput("location")
34+
clusterName := bpt.GetStringOutput("cluster_name")
35+
serviceAccount := bpt.GetStringOutput("service_account")
36+
37+
op := gcloud.Runf(t, "container clusters describe %s --zone %s --project %s", clusterName, location, projectId)
38+
g := golden.NewOrUpdate(t, op.String(),
39+
golden.WithSanitizer(golden.StringSanitizer(serviceAccount, "SERVICE_ACCOUNT")),
40+
golden.WithSanitizer(golden.StringSanitizer(projectId, "PROJECT_ID")),
41+
golden.WithSanitizer(golden.StringSanitizer(clusterName, "CLUSTER_NAME")),
42+
)
43+
validateJSONPaths := []string{
44+
"autopilot.enabled",
45+
"location",
46+
"privateClusterConfig.enablePrivateEndpoint",
47+
"privateClusterConfig.enablePrivateNodes",
48+
"addonsConfig.horizontalPodAutoscaling",
49+
"addonsConfig.httpLoadBalancing",
50+
"addonsConfig.kubernetesDashboard.disabled",
51+
"addonsConfig.networkPolicyConfig.disabled",
52+
}
53+
for _, pth := range validateJSONPaths {
54+
g.JSONEq(assert, op, pth)
55+
}
56+
assert.Contains([]string{"RUNNING", "RECONCILING"}, op.Get("status").String())
57+
})
58+
59+
bpt.Test()
60+
}

0 commit comments

Comments
 (0)