command: cleanup test function names
This commit is contained in:
parent
7ba0c003f2
commit
09d7fb7c27
|
@ -186,12 +186,18 @@ func testCwd(t *testing.T) (string, string) {
|
|||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
os.Chdir(tmp)
|
||||
if err := os.Chdir(tmp); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
return tmp, cwd
|
||||
}
|
||||
|
||||
// fixDir is used to as a defer to testDir
|
||||
func fixDir(tmp, cwd string) {
|
||||
os.Chdir(cwd)
|
||||
os.RemoveAll(tmp)
|
||||
// testFixCwd is used to as a defer to testDir
|
||||
func testFixCwd(t *testing.T, tmp, cwd string) {
|
||||
if err := os.Chdir(cwd); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if err := os.RemoveAll(tmp); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ func TestInit_dstInSrc(t *testing.T) {
|
|||
|
||||
func TestInit_remoteState(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
s := terraform.NewState()
|
||||
conf, srv := testRemoteState(t, s, 200)
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
|
||||
func TestPull_noRemote(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
c := &PullCommand{
|
||||
|
@ -35,7 +35,7 @@ func TestPull_noRemote(t *testing.T) {
|
|||
|
||||
func TestPull_cliRemote(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
s := terraform.NewState()
|
||||
conf, srv := testRemoteState(t, s, 200)
|
||||
|
@ -63,7 +63,7 @@ func TestPull_cliRemote(t *testing.T) {
|
|||
|
||||
func TestPull_local(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
s := terraform.NewState()
|
||||
s.Serial = 10
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func TestPush_noRemote(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
c := &PushCommand{
|
||||
|
@ -31,7 +31,7 @@ func TestPush_noRemote(t *testing.T) {
|
|||
|
||||
func TestPush_cliRemote_noState(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
s := terraform.NewState()
|
||||
conf, srv := testRemoteState(t, s, 200)
|
||||
|
@ -54,7 +54,7 @@ func TestPush_cliRemote_noState(t *testing.T) {
|
|||
|
||||
func TestPush_cliRemote_withState(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
s := terraform.NewState()
|
||||
conf, srv := testRemoteState(t, s, 200)
|
||||
|
@ -98,7 +98,7 @@ func TestPush_cliRemote_withState(t *testing.T) {
|
|||
|
||||
func TestPush_local(t *testing.T) {
|
||||
tmp, cwd := testCwd(t)
|
||||
defer fixDir(tmp, cwd)
|
||||
defer testFixCwd(t, tmp, cwd)
|
||||
|
||||
s := terraform.NewState()
|
||||
s.Serial = 5
|
||||
|
|
Loading…
Reference in New Issue