@ -189,17 +189,17 @@ func TestRefresh_defaultState(t *testing.T) {
// Write the state file in a temporary directory with the
// default filename.
td , err := ioutil . TempDir ( "" , "tf" )
if err != nil {
t . Fatalf ( "err: %s" , err )
}
statePath := filepath . Join ( td , DefaultStateFilename )
statePath := testStateFile ( t , originalState )
localState := & state . LocalState { Path : statePath }
if err := localState . WriteState( originalState ) ; err != nil {
if err := localState . RefreshState ( ) ; err != nil {
t . Fatal ( err )
}
serial := localState . State ( ) . Serial
s := localState . State ( )
if s == nil {
t . Fatal ( "empty test state" )
}
serial := s . Serial
// Change to that directory
cwd , err := os . Getwd ( )
@ -224,6 +224,7 @@ func TestRefresh_defaultState(t *testing.T) {
p . RefreshReturn = newInstanceState ( "yes" )
args := [ ] string {
"-state" , statePath ,
testFixturePath ( "refresh" ) ,
}
if code := c . Run ( args ) ; code != 0 {
@ -364,7 +365,7 @@ func TestRefresh_outPath(t *testing.T) {
statePath := testStateFile ( t , state )
// Output path
outf , err := ioutil . TempFile ( "" , "tf" )
outf , err := ioutil . TempFile ( testingDir , "tf" )
if err != nil {
t . Fatalf ( "err: %s" , err )
}
@ -585,7 +586,7 @@ func TestRefresh_backup(t *testing.T) {
statePath := testStateFile ( t , state )
// Output path
outf , err := ioutil . TempFile ( "" , "tf" )
outf , err := ioutil . TempFile ( testingDir , "tf" )
if err != nil {
t . Fatalf ( "err: %s" , err )
}
@ -594,7 +595,7 @@ func TestRefresh_backup(t *testing.T) {
os . Remove ( outPath )
// Backup path
backupf , err := ioutil . TempFile ( "" , "tf" )
backupf , err := ioutil . TempFile ( testingDir , "tf" )
if err != nil {
t . Fatalf ( "err: %s" , err )
}
@ -679,7 +680,7 @@ func TestRefresh_disableBackup(t *testing.T) {
statePath := testStateFile ( t , state )
// Output path
outf , err := ioutil . TempFile ( "" , "tf" )
outf , err := ioutil . TempFile ( testingDir , "tf" )
if err != nil {
t . Fatalf ( "err: %s" , err )
}