-
Notifications
You must be signed in to change notification settings - Fork 992
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use RetryContext to eliminate busy-waiting
also add a couple of tests to cover the other timeout cases. Fixes #2614
- Loading branch information
1 parent
a443c94
commit 2fd6436
Showing
4 changed files
with
229 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
manifest/test/acceptance/testdata/Wait/wait_for_fields_pod_invalid.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
resource "kubernetes_manifest" "test" { | ||
|
||
manifest = { | ||
apiVersion = "v1" | ||
kind = "Pod" | ||
|
||
metadata = { | ||
name = var.name | ||
namespace = var.namespace | ||
|
||
annotations = { | ||
"test.terraform.io" = "test" | ||
} | ||
|
||
labels = { | ||
app = "nginx" | ||
} | ||
} | ||
|
||
spec = { | ||
containers = [ | ||
{ | ||
name = "nginx" | ||
image = "nginx:1.19" | ||
|
||
readinessProbe = { | ||
initialDelaySeconds = 10 | ||
|
||
httpGet = { | ||
path = "/" | ||
port = 80 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
wait { | ||
fields = { | ||
"status.phase" = "Invalid", | ||
} | ||
} | ||
|
||
timeouts { | ||
create = "5s" | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
manifest/test/acceptance/testdata/Wait/wait_for_rollout_invalid.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
resource kubernetes_manifest wait_for_rollout { | ||
manifest = { | ||
apiVersion = "apps/v1" | ||
kind = "Deployment" | ||
metadata = { | ||
name = var.name | ||
namespace = var.namespace | ||
} | ||
spec = { | ||
replicas = 2 | ||
selector = { | ||
matchLabels = { | ||
app = "tf-acc-test" | ||
} | ||
} | ||
template = { | ||
metadata = { | ||
labels = { | ||
app = "tf-acc-test" | ||
} | ||
} | ||
spec = { | ||
containers = [ | ||
{ | ||
image = "nginx:invalid-does-not-exist" | ||
imagePullPolicy = "IfNotPresent" | ||
name = "tf-acc-test" | ||
readinessProbe = { | ||
httpGet = { | ||
port = 80 | ||
path = "/" | ||
} | ||
initialDelaySeconds = 10 | ||
} | ||
}, | ||
] | ||
} | ||
} | ||
} | ||
} | ||
|
||
wait { | ||
rollout = true | ||
} | ||
|
||
timeouts { | ||
create = "5s" | ||
} | ||
} |
Oops, something went wrong.