mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
d40085f374
They still aren't passing, but this is just enough updating to make the test program compile successfully after the refactoring related to provider installation. They are now using the mock provider source offered by the getproviders package, which is similar but not totally identical to the idea of mocking the entire installer as these tests used to do, and so many of them need further adjustment to still be testing what they intended to test under this new architecture. Subsequent commits will gradually repair the failing tests.
45 lines
866 B
Go
45 lines
866 B
Go
package command
|
|
|
|
import (
|
|
"os"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestPluginPath(t *testing.T) {
|
|
td := testTempDir(t)
|
|
defer os.RemoveAll(td)
|
|
defer testChdir(t, td)()
|
|
|
|
pluginPath := []string{"a", "b", "c"}
|
|
|
|
m := Meta{}
|
|
if err := m.storePluginPath(pluginPath); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
restoredPath, err := m.loadPluginPath()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if !reflect.DeepEqual(pluginPath, restoredPath) {
|
|
t.Fatalf("expected plugin path %#v, got %#v", pluginPath, restoredPath)
|
|
}
|
|
}
|
|
|
|
func TestInternalProviders(t *testing.T) {
|
|
m := Meta{}
|
|
internal := m.internalProviders()
|
|
tfProvider, err := internal["terraform"]()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
schema := tfProvider.GetSchema()
|
|
_, found := schema.DataSources["terraform_remote_state"]
|
|
if !found {
|
|
t.Errorf("didn't find terraform_remote_state in internal \"terraform\" provider")
|
|
}
|
|
}
|