-
Notifications
You must be signed in to change notification settings - Fork 99
/
aws_mechanics_test.go
119 lines (112 loc) · 3.36 KB
/
aws_mechanics_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------
package mechanics_test
import (
"fmt"
"testing"
"github.com/google/uuid"
"github.com/project-radius/radius/test/functional/corerp"
"github.com/project-radius/radius/test/step"
"github.com/project-radius/radius/test/validation"
)
func Test_AWSRedeployWithUpdatedResourceUpdatesResource(t *testing.T) {
templateFmt := "testdata/aws-mechanics-redeploy-withupdatedresource.step%d.bicep"
name := "radiusfunctionaltestbucket-" + uuid.New().String()
test := corerp.NewCoreRPTest(t, name, []corerp.TestStep{
{
Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 1), "bucketName="+name),
SkipKubernetesOutputResourceValidation: true,
SkipObjectValidation: true,
AWSResources: &validation.AWSResourceSet{
Resources: []validation.AWSResource{
{
Name: name,
Type: validation.AWSS3BucketResourceType,
Identifier: name,
Properties: map[string]any{
"BucketName": name,
"Tags": []any{
map[string]any{
"Key": "testKey",
"Value": "testValue",
},
},
},
},
},
},
},
{
Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 2), "bucketName="+name),
SkipKubernetesOutputResourceValidation: true,
SkipObjectValidation: true,
AWSResources: &validation.AWSResourceSet{
Resources: []validation.AWSResource{
{
Name: name,
Type: validation.AWSS3BucketResourceType,
Identifier: name,
Properties: map[string]any{
"BucketName": name,
"Tags": []any{
map[string]any{
"Key": "testKey",
"Value": "testValue2",
},
},
},
},
},
},
},
})
test.Test(t)
}
func Test_AWSRedeployWithCreateAndWriteOnlyPropertyUpdate(t *testing.T) {
t.Skip("This test will fail because step 2 is updating a create-and-write-only property.")
name := "my-db"
templateFmt := "testdata/aws-mechanics-redeploy-withcreateandwriteonlypropertyupdate.step%d.bicep"
test := corerp.NewCoreRPTest(t, name, []corerp.TestStep{
{
Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 1)),
SkipKubernetesOutputResourceValidation: true,
SkipObjectValidation: true,
AWSResources: &validation.AWSResourceSet{
Resources: []validation.AWSResource{
{
Name: name,
Type: validation.AWSRDSDBInstanceResourceType,
Identifier: name,
Properties: map[string]any{
"Endpoint": map[string]any{
"Port": 1444,
},
},
},
},
},
},
{
Executor: step.NewDeployExecutor(fmt.Sprintf(templateFmt, 2)),
SkipKubernetesOutputResourceValidation: true,
SkipObjectValidation: true,
AWSResources: &validation.AWSResourceSet{
Resources: []validation.AWSResource{
{
Name: name,
Type: validation.AWSRDSDBInstanceResourceType,
Identifier: name,
Properties: map[string]any{
"Endpoint": map[string]any{
"Port": 1444,
},
},
},
},
},
},
})
test.Test(t)
}