github.com/johandry/terraform@v0.11.12-beta1/plugin/discovery/meta_test.go (about)

     1  package discovery
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestMetaSHA256(t *testing.T) {
     9  	m := PluginMeta{
    10  		Path: "test-fixtures/current-style-plugins/mockos_mockarch/terraform-foo-bar_v0.0.1",
    11  	}
    12  	hash, err := m.SHA256()
    13  	if err != nil {
    14  		t.Fatalf("failed: %s", err)
    15  	}
    16  
    17  	got := fmt.Sprintf("%x", hash)
    18  	want := "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" // (hash of empty file)
    19  	if got != want {
    20  		t.Errorf("incorrect hash %s; want %s", got, want)
    21  	}
    22  }