Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd570ce7

Browse files
authored
test(provisioner/terraform): clean up testdata structure (#17074)
1 parent4e38e6d commitd570ce7

File tree

117 files changed

+26
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+26
-24
lines changed

‎provisioner/terraform/resources_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ func TestConvertResources(t *testing.T) {
863863
expected:=expected
864864
t.Run(folderName,func(t*testing.T) {
865865
t.Parallel()
866-
dir:=filepath.Join(filepath.Dir(filename),"testdata",folderName)
866+
dir:=filepath.Join(filepath.Dir(filename),"testdata","resources",folderName)
867867
t.Run("Plan",func(t*testing.T) {
868868
t.Parallel()
869869
ctx,logger:=ctxAndLogger(t)
@@ -1021,7 +1021,7 @@ func TestAppSlugValidation(t *testing.T) {
10211021
_,filename,_,_:=runtime.Caller(0)
10221022

10231023
// Load the multiple-apps state file and edit it.
1024-
dir:=filepath.Join(filepath.Dir(filename),"testdata","multiple-apps")
1024+
dir:=filepath.Join(filepath.Dir(filename),"testdata","resources","multiple-apps")
10251025
tfPlanRaw,err:=os.ReadFile(filepath.Join(dir,"multiple-apps.tfplan.json"))
10261026
require.NoError(t,err)
10271027
vartfPlan tfjson.Plan
@@ -1070,7 +1070,7 @@ func TestAppSlugDuplicate(t *testing.T) {
10701070
// nolint:dogsled
10711071
_,filename,_,_:=runtime.Caller(0)
10721072

1073-
dir:=filepath.Join(filepath.Dir(filename),"testdata","multiple-apps")
1073+
dir:=filepath.Join(filepath.Dir(filename),"testdata","resources","multiple-apps")
10741074
tfPlanRaw,err:=os.ReadFile(filepath.Join(dir,"multiple-apps.tfplan.json"))
10751075
require.NoError(t,err)
10761076
vartfPlan tfjson.Plan
@@ -1098,7 +1098,7 @@ func TestAgentNameInvalid(t *testing.T) {
10981098
// nolint:dogsled
10991099
_,filename,_,_:=runtime.Caller(0)
11001100

1101-
dir:=filepath.Join(filepath.Dir(filename),"testdata","multiple-agents")
1101+
dir:=filepath.Join(filepath.Dir(filename),"testdata","resources","multiple-agents")
11021102
tfPlanRaw,err:=os.ReadFile(filepath.Join(dir,"multiple-agents.tfplan.json"))
11031103
require.NoError(t,err)
11041104
vartfPlan tfjson.Plan
@@ -1147,7 +1147,7 @@ func TestAgentNameDuplicate(t *testing.T) {
11471147
// nolint:dogsled
11481148
_,filename,_,_:=runtime.Caller(0)
11491149

1150-
dir:=filepath.Join(filepath.Dir(filename),"testdata","multiple-agents")
1150+
dir:=filepath.Join(filepath.Dir(filename),"testdata","resources","multiple-agents")
11511151
tfPlanRaw,err:=os.ReadFile(filepath.Join(dir,"multiple-agents.tfplan.json"))
11521152
require.NoError(t,err)
11531153
vartfPlan tfjson.Plan
@@ -1178,7 +1178,7 @@ func TestMetadataResourceDuplicate(t *testing.T) {
11781178
ctx,logger:=ctxAndLogger(t)
11791179

11801180
// Load the multiple-apps state file and edit it.
1181-
dir:=filepath.Join("testdata","resource-metadata-duplicate")
1181+
dir:=filepath.Join("testdata","resources","resource-metadata-duplicate")
11821182
tfPlanRaw,err:=os.ReadFile(filepath.Join(dir,"resource-metadata-duplicate.tfplan.json"))
11831183
require.NoError(t,err)
11841184
vartfPlan tfjson.Plan
@@ -1201,7 +1201,7 @@ func TestParameterValidation(t *testing.T) {
12011201
_,filename,_,_:=runtime.Caller(0)
12021202

12031203
// Load the rich-parameters state file and edit it.
1204-
dir:=filepath.Join(filepath.Dir(filename),"testdata","rich-parameters")
1204+
dir:=filepath.Join(filepath.Dir(filename),"testdata","resources","rich-parameters")
12051205
tfPlanRaw,err:=os.ReadFile(filepath.Join(dir,"rich-parameters.tfplan.json"))
12061206
require.NoError(t,err)
12071207
vartfPlan tfjson.Plan

‎provisioner/terraform/testdata/generate.sh

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
set -euo pipefail
4-
cd"$(dirname"${BASH_SOURCE[0]}")"
4+
cd"$(dirname"${BASH_SOURCE[0]}")/resources"
55

66
generate() {
77
local name="$1"
@@ -70,22 +70,17 @@ run() {
7070
cd"$d"
7171
name=$(basename"$(pwd)")
7272

73-
# This needs care to update correctly.
74-
if [[$name=="kubernetes-metadata" ]];then
75-
echo"== Skipping:$name"
76-
return 0
77-
fi
78-
79-
# This directory is used for a different purpose (quick workaround).
80-
if [[$name=="cleanup-stale-plugins" ]];then
81-
echo"== Skipping:$name"
82-
return 0
83-
fi
84-
85-
if [[$name=="timings-aggregation" ]];then
86-
echo"== Skipping:$name"
87-
return 0
88-
fi
73+
toskip=(
74+
# This needs care to update correctly.
75+
"kubernetes-metadata"
76+
)
77+
forskipin"${toskip[@]}";do
78+
if [[$name=="$skip" ]];then
79+
echo"== Skipping:$name"
80+
touch"$name.tfplan.json""$name.tfplan.dot""$name.tfstate.json""$name.tfstate.dot"
81+
return 0
82+
fi
83+
done
8984

9085
echo"== Generating test data for:$name"
9186
if! out="$(generate"$name"2>&1)";then

‎provisioner/terraform/testdata/presets/presets.tfplan.jsonrenamed to‎provisioner/terraform/testdata/resources/presets/presets.tfplan.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎provisioner/terraform/testdata/presets/presets.tfstate.jsonrenamed to‎provisioner/terraform/testdata/resources/presets/presets.tfstate.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp