opentofu/internal/command/plugins_lock_test.go
Martin Atkins ffe056bacb Move command/ to internal/command/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00

28 lines
576 B
Go

package command
import (
"io/ioutil"
"os"
"reflect"
"testing"
)
func TestPluginSHA256LockFile_Read(t *testing.T) {
f, err := ioutil.TempFile(testingDir, "tf-pluginsha1lockfile-test-")
if err != nil {
t.Fatalf("failed to create temporary file: %s", err)
}
f.Close()
defer os.Remove(f.Name())
plf := &pluginSHA256LockFile{
Filename: f.Name(),
}
// Initially the file is invalid, so we should get an empty map.
digests := plf.Read()
if !reflect.DeepEqual(digests, map[string][]byte{}) {
t.Errorf("wrong initial content %#v; want empty map", digests)
}
}