(t *testing.T)
| 47 | } |
| 48 | |
| 49 | func 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{ |
nothing calls this directly
no test coverage detected