本文整理匯總了Golang中github.com/hashicorp/terraform/terraform.MockResourceProvisioner.ApplyFn方法的典型用法代碼示例。如果您正苦於以下問題:Golang MockResourceProvisioner.ApplyFn方法的具體用法?Golang MockResourceProvisioner.ApplyFn怎麽用?Golang MockResourceProvisioner.ApplyFn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hashicorp/terraform/terraform.MockResourceProvisioner
的用法示例。
在下文中一共展示了MockResourceProvisioner.ApplyFn方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestApply_parallelism2
func TestApply_parallelism2(t *testing.T) {
statePath := testTempFile(t)
ui := new(cli.MockUi)
p := testProvider()
pr := new(terraform.MockResourceProvisioner)
pr.ApplyFn = func(*terraform.InstanceState, *terraform.ResourceConfig) error {
time.Sleep(time.Second)
return nil
}
args := []string{
"-state", statePath,
"-parallelism=2",
testFixturePath("parallelism"),
}
c := &ApplyCommand{
Meta: Meta{
ContextOpts: testCtxConfigWithShell(p, pr),
Ui: ui,
},
}
start := time.Now()
if code := c.Run(args); code != 0 {
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
}
elapsed := time.Since(start).Seconds()
// This test should take exactly one second, plus some minor amount of execution time.
if elapsed < 1 || elapsed > 1.2 {
t.Fatalf("bad: %f\n\n%s", elapsed, ui.ErrorWriter.String())
}
}