MCPcopy
hub / github.com/opentofu/opentofu / writeStateForTesting

Function writeStateForTesting

internal/command/command_test.go:324–331  ·  view source on GitHub ↗

writeStateForTesting is a helper that writes the given naked state to the given writer, generating a stub *statefile.File wrapper which is then immediately discarded.

(state *states.State, w io.Writer)

Source from the content-addressed store, hash-verified

322// given writer, generating a stub *statefile.File wrapper which is then
323// immediately discarded.
324func writeStateForTesting(state *states.State, w io.Writer) error {
325 sf := &statefile.File{
326 Serial: 0,
327 Lineage: "fake-for-testing",
328 State: state,
329 }
330 return statefile.Write(sf, w, encryption.StateEncryptionDisabled())
331}
332
333// testStateMgrCurrentLineage returns the current lineage for the given state
334// manager, or the empty string if it does not use lineage. This is primarily

Calls 2

WriteFunction · 0.92
StateEncryptionDisabledFunction · 0.92

Tested by

no test coverage detected