opentofu/internal/plugin/discovery/meta_test.go
namgyalangmo cb2e9119aa
Update copyright notice (#1232)
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
2024-02-08 09:48:59 +00:00

27 lines
621 B
Go

// Copyright (c) The OpenTofu Authors
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2023 HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package discovery
import (
"fmt"
"testing"
)
func TestMetaSHA256(t *testing.T) {
m := PluginMeta{
Path: "testdata/current-style-plugins/mockos_mockarch/terraform-foo-bar_v0.0.1",
}
hash, err := m.SHA256()
if err != nil {
t.Fatalf("failed: %s", err)
}
got := fmt.Sprintf("%x", hash)
want := "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" // (hash of empty file)
if got != want {
t.Errorf("incorrect hash %s; want %s", got, want)
}
}