github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/plugin/discovery/get_cache_test.go (about)

     1  package discovery
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestLocalPluginCache(t *testing.T) {
     8  	cache := NewLocalPluginCache("test-fixtures/plugin-cache")
     9  
    10  	foo1Path := cache.CachedPluginPath("provider", "foo", VersionStr("v0.0.1").MustParse())
    11  	if foo1Path == "" {
    12  		t.Errorf("foo v0.0.1 not found; should have been found")
    13  	}
    14  
    15  	foo2Path := cache.CachedPluginPath("provider", "foo", VersionStr("v0.0.2").MustParse())
    16  	if foo2Path != "" {
    17  		t.Errorf("foo v0.0.2 found at %s; should not have been found", foo2Path)
    18  	}
    19  
    20  	baz1Path := cache.CachedPluginPath("provider", "baz", VersionStr("v0.0.1").MustParse())
    21  	if baz1Path != "" {
    22  		t.Errorf("baz v0.0.1 found at %s; should not have been found", baz1Path)
    23  	}
    24  
    25  	baz2Path := cache.CachedPluginPath("provider", "baz", VersionStr("v0.0.2").MustParse())
    26  	if baz1Path != "" {
    27  		t.Errorf("baz v0.0.2 found at %s; should not have been found", baz2Path)
    28  	}
    29  }