Skip to content

Commit

Permalink
[Test] Pass expiry date dynamically to the function
Browse files Browse the repository at this point in the history
  • Loading branch information
muneeb-jan committed Dec 2, 2024
1 parent 7278aaf commit 52e6f2b
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package acceptance
import (
"fmt"
"testing"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand Down Expand Up @@ -108,7 +109,15 @@ resource "opentelekomcloud_cce_cluster_v3" "cluster_1" {
data "opentelekomcloud_cce_cluster_kubeconfig_v3" "this" {
cluster_id = opentelekomcloud_cce_cluster_v3.cluster_1.id
expiry_date = "2024-02-01"
expiry_date = "%s"
}
`, common.DataSourceSubnet, cceName)
`, common.DataSourceSubnet, cceName, GetDatePlusTwo())
}

// GetDatePlusTwo returns the date for today + 2 days in the YYYY-MM-DD format.
func GetDatePlusTwo() string {
today := time.Now()
futureDate := today.AddDate(0, 0, 2)
formattedDate := futureDate.Format("2006-01-02")
return formattedDate
}

0 comments on commit 52e6f2b

Please sign in to comment.