MCPcopy Create free account
hub / github.com/coder/coder / TestOnlyDataResources

Function TestOnlyDataResources

provisioner/terraform/executor_internal_test.go:49–175  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestOnlyDataResources(t *testing.T) {
50 t.Parallel()
51
52 tests := []struct {
53 name string
54 stateMod *tfjson.StateModule
55 expected *tfjson.StateModule
56 }{
57 {
58 name: "empty state module",
59 stateMod: &tfjson.StateModule{},
60 expected: &tfjson.StateModule{},
61 },
62 {
63 name: "only data resources",
64 stateMod: &tfjson.StateModule{
65 Resources: []*tfjson.StateResource{
66 {Name: "cat", Type: "coder_parameter", Mode: "data", Address: "cat-address"},
67 {Name: "cow", Type: "foobaz", Mode: "data", Address: "cow-address"},
68 },
69 ChildModules: []*tfjson.StateModule{
70 {
71 Resources: []*tfjson.StateResource{
72 {Name: "child-cat", Type: "coder_parameter", Mode: "data", Address: "child-cat-address"},
73 {Name: "child-dog", Type: "foobar", Mode: "data", Address: "child-dog-address"},
74 },
75 Address: "child-module-1",
76 },
77 },
78 Address: "fake-module",
79 },
80 expected: &tfjson.StateModule{
81 Resources: []*tfjson.StateResource{
82 {Name: "cat", Type: "coder_parameter", Mode: "data", Address: "cat-address"},
83 {Name: "cow", Type: "foobaz", Mode: "data", Address: "cow-address"},
84 },
85 ChildModules: []*tfjson.StateModule{
86 {
87 Resources: []*tfjson.StateResource{
88 {Name: "child-cat", Type: "coder_parameter", Mode: "data", Address: "child-cat-address"},
89 {Name: "child-dog", Type: "foobar", Mode: "data", Address: "child-dog-address"},
90 },
91 Address: "child-module-1",
92 },
93 },
94 Address: "fake-module",
95 },
96 },
97 {
98 name: "only non-data resources",
99 stateMod: &tfjson.StateModule{
100 Resources: []*tfjson.StateResource{
101 {Name: "cat", Type: "coder_parameter", Mode: "foobar", Address: "cat-address"},
102 {Name: "cow", Type: "foobaz", Mode: "foo", Address: "cow-address"},
103 },
104 ChildModules: []*tfjson.StateModule{
105 {
106 Resources: []*tfjson.StateResource{

Callers

nothing calls this directly

Calls 4

onlyDataResourcesFunction · 0.85
RunMethod · 0.65
MarshalMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected