apply-test
This commit is contained in:
parent
a2b5811f50
commit
6a20c35d61
|
@ -8,10 +8,12 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -59,6 +61,36 @@ func TestApply(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// test apply with locked state
|
||||
func TestApply_lockedState(t *testing.T) {
|
||||
statePath := testTempFile(t)
|
||||
|
||||
locker := exec.Command("go", "run", "testadata/statelocker.go", statePath)
|
||||
locker.Stderr = os.Stderr
|
||||
if err := locker.Start(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer locker.Process.Signal(syscall.SIGTERM)
|
||||
|
||||
p := testProvider()
|
||||
ui := new(cli.MockUi)
|
||||
c := &ApplyCommand{
|
||||
Meta: Meta{
|
||||
ContextOpts: testCtxConfig(p),
|
||||
Ui: ui,
|
||||
},
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"-state", statePath,
|
||||
testFixturePath("apply"),
|
||||
}
|
||||
if code := c.Run(args); code != 0 {
|
||||
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
|
||||
}
|
||||
}
|
||||
|
||||
// high water mark counter
|
||||
type hwm struct {
|
||||
sync.Mutex
|
||||
|
|
Loading…
Reference in New Issue