MCPcopy
hub / github.com/opentofu/opentofu / testStateFile

Function testStateFile

internal/command/command_test.go:392–409  ·  view source on GitHub ↗
(t *testing.T, s *states.State)

Source from the content-addressed store, hash-verified

390}
391
392func testStateFile(t *testing.T, s *states.State) string {
393 t.Helper()
394
395 path := testTempFile(t)
396
397 f, err := os.Create(path)
398 if err != nil {
399 t.Fatalf("failed to create temporary state file %s: %s", path, err)
400 }
401 defer f.Close()
402
403 err = writeStateForTesting(s, f)
404 if err != nil {
405 t.Fatalf("failed to write state to temporary file %s: %s", path, err)
406 }
407
408 return path
409}
410
411// testStateFileDefault writes the state out to the default statefile
412// in the cwd. Use `testCwd` to change into a temp cwd.

Callers 15

TestApply_refreshFunction · 0.70
TestApply_refreshFalseFunction · 0.70
TestApply_stateFunction · 0.70
TestApply_backupFunction · 0.70
TestApply_disableBackupFunction · 0.70
TestApply_replaceFunction · 0.70
TestStateReplaceProviderFunction · 0.70
TestStateListFunction · 0.70
TestStateListWithIDFunction · 0.70

Calls 4

writeStateForTestingFunction · 0.85
testTempFileFunction · 0.70
CloseMethod · 0.65
CreateMethod · 0.45

Tested by

no test coverage detected