Skip to content

Commit

Permalink
Skip app services test because of var deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Talina06 committed Dec 7, 2023
1 parent efe57d3 commit 1e27d6d
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 110 deletions.
102 changes: 51 additions & 51 deletions internal/resources/acceptance_tests/allowlist_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (

func TestAccAllowListTestCases(t *testing.T) {
resourceName := "new_cluster"
resourceReference := "capella_cluster." + resourceName
resourceReference := "couchbase-capella_cluster." + resourceName
projectResourceName := "terraform_project"
projectResourceReference := "capella_project." + projectResourceName
projectResourceReference := "couchbase-capella_project." + projectResourceName
cidr := "10.250.250.0/23"

testCfg := acctest.Cfg
Expand All @@ -40,28 +40,28 @@ func TestAccAllowListTestCases(t *testing.T) {
{
Config: testAccAddIpWithReqFields(&testCfg),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("capella_allowlist.add_allowlist_req", "cidr", "10.1.1.1/32"),
resource.TestCheckResourceAttrSet("capella_allowlist.add_allowlist_req", "id"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.add_allowlist_req", "cidr", "10.1.1.1/32"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.add_allowlist_req", "id"),
),
},
//IP with optional fields
{
Config: testAccAddIpWithOptionalFields(testCfg, "add_allowlist_opt", "10.4.5.6/32"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("capella_allowlist.add_allowlist_opt", "cidr", "10.4.5.6/32"),
resource.TestCheckResourceAttrSet("capella_allowlist.add_allowlist_opt", "id"),
resource.TestCheckResourceAttrSet("capella_allowlist.add_allowlist_opt", "expires_at"),
resource.TestCheckResourceAttr("capella_allowlist.add_allowlist_opt", "comment", "terraform allow list acceptance test"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.add_allowlist_opt", "cidr", "10.4.5.6/32"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.add_allowlist_opt", "id"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.add_allowlist_opt", "expires_at"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.add_allowlist_opt", "comment", "terraform allow list acceptance test"),
),
},
//Unspecified IP address
{
Config: testAccAddIpWithOptionalFields(testCfg, "add_allowlist_quadzero", "0.0.0.0/0"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("capella_allowlist.add_allowlist_quadzero", "cidr", "0.0.0.0/0"),
resource.TestCheckResourceAttrSet("capella_allowlist.add_allowlist_quadzero", "id"),
resource.TestCheckResourceAttrSet("capella_allowlist.add_allowlist_quadzero", "expires_at"),
resource.TestCheckResourceAttr("capella_allowlist.add_allowlist_quadzero", "comment", "terraform allow list acceptance test"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.add_allowlist_quadzero", "cidr", "0.0.0.0/0"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.add_allowlist_quadzero", "id"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.add_allowlist_quadzero", "expires_at"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.add_allowlist_quadzero", "comment", "terraform allow list acceptance test"),
),
},
//expired IP
Expand All @@ -79,10 +79,10 @@ func TestAccAllowListTestCases(t *testing.T) {
{
Config: testAccAddExpiringIP(testCfg, "add_expiring_ip", "10.1.2.3/32"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("capella_allowlist.add_expiring_ip", "cidr", "10.1.2.3/32"),
resource.TestCheckResourceAttrSet("capella_allowlist.add_expiring_ip", "id"),
resource.TestCheckResourceAttrSet("capella_allowlist.add_expiring_ip", "expires_at"),
resource.TestCheckResourceAttr("capella_allowlist.add_expiring_ip", "comment", "terraform allow list acceptance test"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.add_expiring_ip", "cidr", "10.1.2.3/32"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.add_expiring_ip", "id"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.add_expiring_ip", "expires_at"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.add_expiring_ip", "comment", "terraform allow list acceptance test"),
acctest.TestAccWait(time.Second*250)),
},
},
Expand All @@ -92,9 +92,9 @@ func TestAccAllowListTestCases(t *testing.T) {
// Delete the ip when the ip is deleted through api
func TestAccAllowedIPDeleteIP(t *testing.T) {
clusterName := "new_cluster"
clusterResourceReference := "capella_cluster." + clusterName
clusterResourceReference := "couchbase-capella_cluster." + clusterName
projectResourceName := "terraform_project"
projectResourceReference := "capella_project." + projectResourceName
projectResourceReference := "couchbase-capella_project." + projectResourceName
cidr := "10.250.250.0/23"

testCfg := acctest.Cfg
Expand All @@ -111,11 +111,11 @@ func TestAccAllowedIPDeleteIP(t *testing.T) {
{
Config: testAccAddIpWithOptionalFields(testCfg, "allowList_delete", "10.2.3.4/32"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("capella_allowlist.allowList_delete", "cidr", "10.2.3.4/32"),
resource.TestCheckResourceAttrSet("capella_allowlist.allowList_delete", "id"),
resource.TestCheckResourceAttrSet("capella_allowlist.allowList_delete", "expires_at"),
resource.TestCheckResourceAttr("capella_allowlist.allowList_delete", "comment", "terraform allow list acceptance test"),
testAccDeleteAllowIP(clusterResourceReference, projectResourceReference, "capella_allowlist.allowList_delete"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.allowList_delete", "cidr", "10.2.3.4/32"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.allowList_delete", "id"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.allowList_delete", "expires_at"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.allowList_delete", "comment", "terraform allow list acceptance test"),
testAccDeleteAllowIP(clusterResourceReference, projectResourceReference, "couchbase-capella_allowlist.allowList_delete"),
),
ExpectNonEmptyPlan: true,
RefreshState: false,
Expand All @@ -127,9 +127,9 @@ func TestAccAllowedIPDeleteIP(t *testing.T) {
// Delete the ip when the cluster is destroyed through api
func TestAccAllowedIPDeleteCluster(t *testing.T) {
clusterName := "new_cluster"
clusterResourceReference := "capella_cluster." + clusterName
clusterResourceReference := "couchbase-capella_cluster." + clusterName
projectResourceName := "terraform_project"
projectResourceReference := "capella_project." + projectResourceName
projectResourceReference := "couchbase-capella_project." + projectResourceName
cidr := "10.4.2.0/23"
testCfg := acctest.Cfg
resource.Test(t, resource.TestCase{
Expand All @@ -145,10 +145,10 @@ func TestAccAllowedIPDeleteCluster(t *testing.T) {
{
Config: testAccAddIpWithOptionalFields(testCfg, "allowList_delete", "10.4.3.4/32"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("capella_allowlist.allowList_delete", "cidr", "10.4.3.4/32"),
resource.TestCheckResourceAttrSet("capella_allowlist.allowList_delete", "id"),
resource.TestCheckResourceAttrSet("capella_allowlist.allowList_delete", "expires_at"),
resource.TestCheckResourceAttr("capella_allowlist.allowList_delete", "comment", "terraform allow list acceptance test"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.allowList_delete", "cidr", "10.4.3.4/32"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.allowList_delete", "id"),
resource.TestCheckResourceAttrSet("couchbase-capella_allowlist.allowList_delete", "expires_at"),
resource.TestCheckResourceAttr("couchbase-capella_allowlist.allowList_delete", "comment", "terraform allow list acceptance test"),
testAccDeleteCluster(clusterResourceReference, projectResourceReference),
testAccDeleteProject(projectResourceReference),
),
Expand All @@ -164,13 +164,13 @@ func testAccCreateCluster(cfg *string, resourceName, projectResourceName, projec
*cfg = fmt.Sprintf(`
%[1]s
resource "capella_project" "%[3]s" {
resource "couchbase-capella_project" "%[3]s" {
organization_id = var.organization_id
name = "acc_test_project_name"
description = "description"
}
resource "capella_cluster" "%[2]s" {
resource "couchbase-capella_cluster" "%[2]s" {
organization_id = var.organization_id
project_id = %[4]s.id
name = "Terraform Acceptance Test Cluster"
Expand Down Expand Up @@ -234,13 +234,13 @@ func testAccAddIpWithReqFields(cfg *string) string {
%[1]s
output "add_allowlist_req"{
value = capella_allowlist.add_allowlist_req
value = couchbase-capella_allowlist.add_allowlist_req
}
resource "capella_allowlist" "add_allowlist_req" {
resource "couchbase-capella_allowlist" "add_allowlist_req" {
organization_id = var.organization_id
project_id = capella_project.terraform_project.id
cluster_id = capella_cluster.new_cluster.id
project_id = couchbase-capella_project.terraform_project.id
cluster_id = couchbase-capella_cluster.new_cluster.id
cidr = "10.1.1.1/32"
}
Expand All @@ -256,13 +256,13 @@ func testAccAddIpWithOptionalFields(cfg string, resourceName string, cidr string
%[1]s
output "%[2]s"{
value = capella_allowlist.%[2]s
value = couchbase-capella_allowlist.%[2]s
}
resource "capella_allowlist" "%[2]s" {
resource "couchbase-capella_allowlist" "%[2]s" {
organization_id = var.organization_id
project_id = capella_project.terraform_project.id
cluster_id = capella_cluster.new_cluster.id
project_id = couchbase-capella_project.terraform_project.id
cluster_id = couchbase-capella_cluster.new_cluster.id
cidr = "%[3]s"
comment = "terraform allow list acceptance test"
expires_at = "%[4]s"
Expand All @@ -279,13 +279,13 @@ func testAccAddIPSameIP(cfg string, resourceName string, cidr string) string {
%[1]s
output "%[2]s_1"{
value = capella_allowlist.%[2]s_1
value = couchbase-capella_allowlist.%[2]s_1
}
resource "capella_allowlist" "%[2]s_1" {
resource "couchbase-capella_allowlist" "%[2]s_1" {
organization_id = var.organization_id
project_id = capella_project.terraform_project.id
cluster_id = capella_cluster.new_cluster.id
project_id = couchbase-capella_project.terraform_project.id
cluster_id = couchbase-capella_cluster.new_cluster.id
cidr = "%[3]s"
comment = "terraform allow list acceptance test"
expires_at = "%[4]s"
Expand All @@ -301,13 +301,13 @@ func testAccAddIpWithExpiredIP(cfg string, resourceName string, cidr string) str
%[1]s
output "%[2]s"{
value = capella_allowlist.%[2]s
value = couchbase-capella_allowlist.%[2]s
}
resource "capella_allowlist" "%[2]s" {
resource "couchbase-capella_allowlist" "%[2]s" {
organization_id = var.organization_id
project_id = capella_project.terraform_project.id
cluster_id = capella_cluster.new_cluster.id
project_id = couchbase-capella_project.terraform_project.id
cluster_id = couchbase-capella_cluster.new_cluster.id
cidr = "%[3]s"
comment = "terraform allow list acceptance test"
expires_at = "%[4]s"
Expand All @@ -325,13 +325,13 @@ func testAccAddExpiringIP(cfg string, resourceName string, cidr string) string {
%[1]s
output "%[2]s"{
value = capella_allowlist.%[2]s
value = couchbase-capella_allowlist.%[2]s
}
resource "capella_allowlist" "%[2]s" {
resource "couchbase-capella_allowlist" "%[2]s" {
organization_id = var.organization_id
project_id = capella_project.terraform_project.id
cluster_id = capella_cluster.new_cluster.id
project_id = couchbase-capella_project.terraform_project.id
cluster_id = couchbase-capella_cluster.new_cluster.id
cidr = "%[3]s"
comment = "terraform allow list acceptance test"
expires_at = "%[4]s"
Expand Down
Loading

0 comments on commit 1e27d6d

Please sign in to comment.