mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Use modern helpers from Go's testing.T API (#2692)
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -14,14 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestProviders(t *testing.T) {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if err := os.Chdir(testFixturePath("providers/basic")); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer os.Chdir(cwd)
|
||||
t.Chdir(testFixturePath("providers/basic"))
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
c := &ProvidersCommand{
|
||||
@@ -50,14 +42,7 @@ func TestProviders(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestProviders_noConfigs(t *testing.T) {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if err := os.Chdir(testFixturePath("")); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer os.Chdir(cwd)
|
||||
t.Chdir(testFixturePath(""))
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
c := &ProvidersCommand{
|
||||
@@ -82,7 +67,7 @@ func TestProviders_noConfigs(t *testing.T) {
|
||||
func TestProviders_modules(t *testing.T) {
|
||||
td := t.TempDir()
|
||||
testCopyDir(t, testFixturePath("providers/modules"), td)
|
||||
defer testChdir(t, td)()
|
||||
t.Chdir(td)
|
||||
|
||||
// first run init with mock provider sources to install the module
|
||||
initUi := new(cli.MockUi)
|
||||
@@ -133,14 +118,7 @@ func TestProviders_modules(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestProviders_state(t *testing.T) {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if err := os.Chdir(testFixturePath("providers/state")); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer os.Chdir(cwd)
|
||||
t.Chdir(testFixturePath("providers/state"))
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
c := &ProvidersCommand{
|
||||
@@ -170,14 +148,7 @@ func TestProviders_state(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestProviders_tests(t *testing.T) {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if err := os.Chdir(testFixturePath("providers/tests")); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
defer os.Chdir(cwd)
|
||||
t.Chdir(testFixturePath("providers/tests"))
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
c := &ProvidersCommand{
|
||||
|
||||
Reference in New Issue
Block a user