mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-23 07:33:32 -06:00
cb2e9119aa
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
50 lines
1023 B
Go
50 lines
1023 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 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.GetProviderSchema()
|
|
_, found := schema.DataSources["terraform_remote_state"]
|
|
if !found {
|
|
t.Errorf("didn't find terraform_remote_state in internal \"terraform\" provider")
|
|
}
|
|
}
|