@@ -195,30 +195,29 @@ func TestAccKubernetesJob_update(t *testing.T) {
195195 })
196196}
197197
198- // FIXME uncomment this check when the TTLSecondsAfterFinished feature gate defaults to true
199- //func TestAccKubernetesJob_ttl_seconds_after_finished(t *testing.T) {
200- // var conf api.Job
201- // name := fmt.Sprintf("tf-acc-test-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum))
202- //
203- // resource.Test(t, resource.TestCase{
204- // PreCheck: func() { testAccPreCheck(t) },
205- // IDRefreshName: "kubernetes_job.test",
206- // IDRefreshIgnore: []string{
207- // "spec.0.selector.0.match_expressions.#",
208- // },
209- // ProviderFactories: testAccProviderFactories,
210- // CheckDestroy: testAccCheckKubernetesJobDestroy,
211- // Steps: []resource.TestStep{
212- // {
213- // Config: testAccKubernetesJobConfig_ttl_seconds_after_finished(name, busyboxImageVersion),
214- // Check: resource.ComposeAggregateTestCheckFunc(
215- // testAccCheckKubernetesJobExists("kubernetes_job.test", &conf),
216- // resource.TestCheckResourceAttr("kubernetes_job.test", "spec.0.ttl_seconds_after_finished", "60"),
217- // ),
218- // },
219- // },
220- // })
221- //}
198+ func TestAccKubernetesJob_ttl_seconds_after_finished (t * testing.T ) {
199+ var conf api.Job
200+ name := fmt .Sprintf ("tf-acc-test-%s" , acctest .RandStringFromCharSet (10 , acctest .CharSetAlphaNum ))
201+
202+ resource .Test (t , resource.TestCase {
203+ PreCheck : func () { testAccPreCheck (t ); skipIfClusterVersionLessThan (t , "1.21.0" ) },
204+ IDRefreshName : "kubernetes_job.test" ,
205+ IDRefreshIgnore : []string {
206+ "spec.0.selector.0.match_expressions.#" ,
207+ },
208+ ProviderFactories : testAccProviderFactories ,
209+ CheckDestroy : testAccCheckKubernetesJobDestroy ,
210+ Steps : []resource.TestStep {
211+ {
212+ Config : testAccKubernetesJobConfig_ttl_seconds_after_finished (name , busyboxImageVersion ),
213+ Check : resource .ComposeAggregateTestCheckFunc (
214+ testAccCheckKubernetesJobExists ("kubernetes_job.test" , & conf ),
215+ resource .TestCheckResourceAttr ("kubernetes_job.test" , "spec.0.ttl_seconds_after_finished" , "60" ),
216+ ),
217+ },
218+ },
219+ })
220+ }
222221
223222func testAccCheckKubernetesJobForceNew (old , new * api.Job , wantNew bool ) resource.TestCheckFunc {
224223 return func (s * terraform.State ) error {
0 commit comments