MCPcopy
hub / github.com/opentofu/opentofu / TestOutput_badVar

Function TestOutput_badVar

internal/command/output_test.go:126–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func TestOutput_badVar(t *testing.T) {
127 originalState := states.BuildState(func(s *states.SyncState) {
128 s.SetOutputValue(
129 addrs.OutputValue{Name: "foo"}.Absolute(addrs.RootModuleInstance),
130 cty.StringVal("bar"),
131 false,
132 "",
133 )
134 })
135 statePath := testStateFile(t, originalState)
136
137 view, done := testView(t)
138 c := &OutputCommand{
139 Meta: Meta{
140 WorkingDir: workdir.NewDir("."),
141 testingOverrides: metaOverridesForProvider(testProvider()),
142 View: view,
143 },
144 }
145
146 args := []string{
147 "-state", statePath,
148 "bar",
149 }
150 code := c.Run(args)
151 output := done(t)
152 if code != 1 {
153 t.Fatalf("bad: \n%s", output.Stderr())
154 }
155}
156
157func TestOutput_blank(t *testing.T) {
158 originalState := states.BuildState(func(s *states.SyncState) {

Callers

nothing calls this directly

Calls 10

RunMethod · 0.95
BuildStateFunction · 0.92
NewDirFunction · 0.92
metaOverridesForProviderFunction · 0.85
StderrMethod · 0.80
testStateFileFunction · 0.70
testViewFunction · 0.70
testProviderFunction · 0.70
SetOutputValueMethod · 0.45
AbsoluteMethod · 0.45

Tested by

no test coverage detected