Skip to content

[AV-127654] Add comprehensive acceptance tests for app_endpoint resource#578

Merged
nimiyajoseph merged 27 commits into
mainfrom
AV-127654-acceptance-test-for-app-end-points
May 11, 2026
Merged

[AV-127654] Add comprehensive acceptance tests for app_endpoint resource#578
nimiyajoseph merged 27 commits into
mainfrom
AV-127654-acceptance-test-for-app-end-points

Conversation

@nimiyajoseph
Copy link
Copy Markdown
Contributor

@nimiyajoseph nimiyajoseph commented May 4, 2026

Jira

Description

Acceptance tests — infrastructure (acceptance_tests/)

globals.go

Added named global bucket constants for all fixture endpoints and app_endpoint resource tests, replacing random-named buckets
Each test gets a stable, pre-created bucket — eliminates 500 errors on bucket creation and 412 errors on bucket cleanup

endpoint_setup.go (new file)

ensureFixtureBucketByName — creates a named bucket exactly once per test process using sync.Once, safe for parallel tests
ensure{ACF,IF,CORS,CORSOriginOnly,OIDC,DefaultOIDC}Endpoint — lazily provisions shared sub-resource test endpoints sequentially before parallel tests run

app_endpoint.go

Added bucket parameter to createAppEndpoint so each caller specifies its own bucket (prevents 409 conflicts)
Added retry loop for transient 500 errors on endpoint creation (App Service overloaded during warmup)

setup_test.go

Updated createAppEndpoint call sites to pass bucket name

Acceptance tests — test files

app_endpoint_acceptance_test.go

Full CRUD and update coverage: NoCors, CorsFullConfig, CorsSpecificOrigins, CorsMaxAgeZeroSilentDrift, OIDCFullFields, OIDCDiscoveryURL, UpdateCorsExpand, UpdateCorsOriginWildcardToSpecific, UpdateAddOIDC, UpdateACF, UpdateCorsMaxAgeToZero, UpdateCorsMaxAgeFromZero
Each test calls ensureFixtureBucketByName before resource.ParallelTest; Terraform HCL no longer owns bucket lifecycle
Known-broken cases skipped with Jira references: CorsDisabledFalseNoOrigin (AV-128217), MultipleOIDC (AV-128222), UpdateRemoveCors (AV-128229), UpdateCorsDisableToggle (AV-128229), UpdateRemoveOIDC (AV-128167)
app_endpoint_access_control_function_acceptance_test.go, app_endpoint_import_filter_acceptance_test.go, app_endpoint_cors_acceptance_test.go, app_endpoint_oidc_provider_acceptance_test.go (new files)

Sub-resource tests using pre-created shared endpoints via ensure*Endpoint
app_endpoint_datasource_acceptance_test.go (new file)

Single-endpoint, activation-status, and filtered-list data source tests
Unfiltered list test (TestAccAppEndpointsDataSource) skipped: returns 500 under parallel load (AV-128XXX)

Type of Change

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • This change updates the ci/cd workflow.
  • Documentation fix/enhancement.

Manual Testing Approach

How was this change tested and do you have evidence? (REQUIRED: Select at least 1)

  • Manually tested
  • Unit tested
  • Acceptance tested
  • Unable to test / will not test (Please provide comments in section below)

Testing

2026/05/04 15:25:24 Using existing project: 8a4f03e1-0c0b-4a25-b655-261fd5f51eaa
2026/05/04 15:28:27 cluster created
2026/05/04 15:29:29 bucket created
2026/05/04 15:34:32 app service created
2026/05/04 15:35:34 app endpoint state Offline
=== RUN   TestAccAppEndpoint
=== PAUSE TestAccAppEndpoint
=== RUN   TestAccAppEndpointInexistentCollection
--- PASS: TestAccAppEndpointInexistentCollection (4.15s)
=== RUN   TestAccAppEndpointNoCors
--- PASS: TestAccAppEndpointNoCors (309.94s)
=== RUN   TestAccAppEndpointCorsDisabledFalseNoOrigin
--- PASS: TestAccAppEndpointCorsDisabledFalseNoOrigin (3.36s)
=== RUN   TestAccAppEndpointCorsFullConfig
=== PAUSE TestAccAppEndpointCorsFullConfig
=== RUN   TestAccAppEndpointMultipleOIDC
--- PASS: TestAccAppEndpointMultipleOIDC (6.22s)
=== RUN   TestAccAppEndpointCorsSpecificOrigins
=== PAUSE TestAccAppEndpointCorsSpecificOrigins
=== RUN   TestAccAppEndpointCorsMaxAgeZeroSilentDrift
=== PAUSE TestAccAppEndpointCorsMaxAgeZeroSilentDrift
=== RUN   TestAccAppEndpointOIDCFullFields
=== PAUSE TestAccAppEndpointOIDCFullFields
=== RUN   TestAccAppEndpointOIDCDiscoveryURL
=== PAUSE TestAccAppEndpointOIDCDiscoveryURL
=== RUN   TestAccAppEndpointUpdateCorsExpand
=== PAUSE TestAccAppEndpointUpdateCorsExpand
=== RUN   TestAccAppEndpointUpdateRemoveCors
--- PASS: TestAccAppEndpointUpdateRemoveCors (311.07s)
=== RUN   TestAccAppEndpointUpdateCorsDisableToggle
=== PAUSE TestAccAppEndpointUpdateCorsDisableToggle
=== RUN   TestAccAppEndpointUpdateCorsOriginWildcardToSpecific
=== PAUSE TestAccAppEndpointUpdateCorsOriginWildcardToSpecific
=== RUN   TestAccAppEndpointUpdateAddOIDC
=== PAUSE TestAccAppEndpointUpdateAddOIDC
=== RUN   TestAccAppEndpointUpdateRemoveOIDC
=== PAUSE TestAccAppEndpointUpdateRemoveOIDC
=== RUN   TestAccAppEndpointUpdateACF
=== PAUSE TestAccAppEndpointUpdateACF
=== RUN   TestAccAppEndpointUpdateCorsMaxAgeToZero
=== PAUSE TestAccAppEndpointUpdateCorsMaxAgeToZero
=== RUN   TestAccAppEndpointUpdateCorsMaxAgeFromZero
--- PASS: TestAccAppEndpointUpdateCorsMaxAgeFromZero (312.27s)
=== RUN   TestAccAppEndpointAccessControlFunction
--- PASS: TestAccAppEndpointAccessControlFunction (5.09s)
=== RUN   TestAccAppEndpointActivationStatus
=== PAUSE TestAccAppEndpointActivationStatus
=== RUN   TestAccAppEndpointCorsResource
--- PASS: TestAccAppEndpointCorsResource (4.99s)
=== RUN   TestAccAppEndpointCorsResourceOriginOnly
=== PAUSE TestAccAppEndpointCorsResourceOriginOnly
=== RUN   TestAccAppEndpointDataSource
=== PAUSE TestAccAppEndpointDataSource
=== RUN   TestAccAppEndpointActivationStatusDataSource
=== PAUSE TestAccAppEndpointActivationStatusDataSource
=== RUN   TestAccAppEndpointsDataSource
=== PAUSE TestAccAppEndpointsDataSource
=== RUN   TestAccAppEndpointsDataSourceFiltered
--- PASS: TestAccAppEndpointsDataSourceFiltered (1.73s)
=== RUN   TestAccAppEndpointImportFilter
--- PASS: TestAccAppEndpointImportFilter (5.57s)
=== RUN   TestAccAppEndpointOidcProvider
--- PASS: TestAccAppEndpointOidcProvider (5.81s)
=== RUN   TestAccAppEndpointDefaultOidcProvider
--- PASS: TestAccAppEndpointDefaultOidcProvider (4.30s)
=== CONT  TestAccAppEndpoint
=== CONT  TestAccAppEndpointUpdateAddOIDC
=== CONT  TestAccAppEndpointCorsResourceOriginOnly
=== CONT  TestAccAppEndpointUpdateCorsMaxAgeToZero
=== CONT  TestAccAppEndpointUpdateACF
=== CONT  TestAccAppEndpointUpdateRemoveOIDC
=== CONT  TestAccAppEndpointUpdateCorsDisableToggle
=== CONT  TestAccAppEndpointUpdateCorsOriginWildcardToSpecific
=== CONT  TestAccAppEndpointCorsMaxAgeZeroSilentDrift
=== CONT  TestAccAppEndpointCorsSpecificOrigins
=== CONT  TestAccAppEndpointUpdateCorsExpand
=== CONT  TestAccAppEndpointOIDCDiscoveryURL
=== CONT  TestAccAppEndpointCorsFullConfig
=== CONT  TestAccAppEndpointActivationStatus
=== RUN   TestAccAppEndpointActivationStatus/App_Endpoint_Activation_Status
--- PASS: TestAccAppEndpointCorsResourceOriginOnly (32.90s)
=== CONT  TestAccAppEndpointOIDCFullFields
=== RUN   TestAccAppEndpointActivationStatus/App_Endpoint_Resync
--- PASS: TestAccAppEndpointActivationStatus (127.97s)
    --- PASS: TestAccAppEndpointActivationStatus/App_Endpoint_Activation_Status (117.29s)
    --- PASS: TestAccAppEndpointActivationStatus/App_Endpoint_Resync (10.68s)
=== CONT  TestAccAppEndpointActivationStatusDataSource
--- PASS: TestAccAppEndpointActivationStatusDataSource (1.80s)
=== CONT  TestAccAppEndpointsDataSource
--- PASS: TestAccAppEndpointsDataSource (1.74s)
=== CONT  TestAccAppEndpointDataSource
--- PASS: TestAccAppEndpointDataSource (1.81s)
--- PASS: TestAccAppEndpointCorsMaxAgeZeroSilentDrift (337.55s)
--- PASS: TestAccAppEndpointOIDCDiscoveryURL (339.83s)
--- PASS: TestAccAppEndpointCorsSpecificOrigins (340.80s)
--- PASS: TestAccAppEndpointUpdateCorsDisableToggle (341.84s)
--- PASS: TestAccAppEndpointCorsFullConfig (342.08s)
--- PASS: TestAccAppEndpointOIDCFullFields (312.96s)
--- PASS: TestAccAppEndpointUpdateCorsMaxAgeToZero (346.65s)
--- PASS: TestAccAppEndpointUpdateRemoveOIDC (346.86s)
--- PASS: TestAccAppEndpointUpdateCorsExpand (409.39s)
--- PASS: TestAccAppEndpoint (410.37s)
--- PASS: TestAccAppEndpointUpdateAddOIDC (411.35s)
--- PASS: TestAccAppEndpointUpdateCorsOriginWildcardToSpecific (411.35s)
--- PASS: TestAccAppEndpointUpdateACF (411.53s)
PASS
ok  	github.com/couchbasecloud/terraform-provider-couchbase-capella/acceptance_tests	2240.372s

Further comments

Copilot AI review requested due to automatic review settings May 4, 2026 11:10
@nimiyajoseph nimiyajoseph requested a review from a team as a code owner May 4, 2026 11:10
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

No PR template selections were detected. Please make sure to fill out the PR template properly by selecting the appropriate checkboxes.

@factory-droid
Copy link
Copy Markdown
Contributor

factory-droid Bot commented May 4, 2026

Droid finished @nimiyajoseph's task —— View job


@nimiyajoseph nimiyajoseph marked this pull request as draft May 4, 2026 11:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds broad acceptance test coverage around the couchbase-capella_app_endpoint ecosystem (CORS, OIDC, import, lifecycle edge-cases), alongside provider-side fixes to reduce import drift and improve deletion stability.

Changes:

  • Extend app_endpoint acceptance coverage with multiple new scenario-focused tests (including import verification via name identifier).
  • Adjust provider Read behavior to avoid suppressing remote CORS during import.
  • Add post-DELETE polling for App Endpoint removal to reduce downstream 412/“still in use” failures (notably bucket deletion races).

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
internal/resources/app_endpoint.go Detect import to avoid CORS suppression; add post-delete polling wait for 404.
acceptance_tests/bucket.go Whitespace-only change.
acceptance_tests/app_endpoint.go Prevent nil-body unmarshal panic by retrying on transient GET errors.
acceptance_tests/app_endpoint_acceptance_test.go Adds many new app_endpoint acceptance scenarios; adjusts some tests to run serially.
acceptance_tests/app_endpoint_datasource_acceptance_test.go New acceptance tests for app_endpoint-related data sources (single, list, filtered).
acceptance_tests/app_endpoint_cors_acceptance_test.go New acceptance tests for the app_endpoint_cors resource (CRUD + import).
acceptance_tests/app_endpoint_oidc_provider_acceptance_test.go New acceptance tests for OIDC provider + default provider resources (CRUD + import).
acceptance_tests/app_endpoint_import_filter_acceptance_test.go New acceptance tests for app_endpoint_import_filter resource (CRUD + import).
acceptance_tests/app_endpoint_access_control_function_acceptance_test.go New acceptance tests for app_endpoint_access_control_function resource (CRUD + import).
Comments suppressed due to low confidence (1)

acceptance_tests/app_endpoint_acceptance_test.go:96

  • This test creates its own bucket/endpoint with randomized names and only validates an expected error; there’s no apparent ordering dependency. Per acceptance test guidelines, prefer resource.ParallelTest here to avoid serializing the suite unnecessarily.
	resource.Test(t, resource.TestCase{
		ProtoV6ProviderFactories: globalProtoV6ProviderFactory,
		Steps: []resource.TestStep{
			{
				Config:      cfg,
				ExpectError: re.MustCompile("Collection Not Found"),
			},
		},

Comment thread internal/resources/app_endpoint.go
Comment thread internal/resources/app_endpoint.go Outdated
Comment thread acceptance_tests/app_endpoint_acceptance_test.go
Comment thread acceptance_tests/app_endpoint_oidc_provider_acceptance_test.go
Comment thread acceptance_tests/app_endpoint_oidc_provider_acceptance_test.go
Comment thread acceptance_tests/app_endpoint_import_filter_acceptance_test.go
Comment thread acceptance_tests/app_endpoint_datasource_acceptance_test.go
Comment thread acceptance_tests/app_endpoint_cors_acceptance_test.go
Comment thread internal/resources/app_endpoint.go Outdated
Comment thread internal/resources/app_endpoint.go
Comment thread acceptance_tests/app_endpoint_cors_acceptance_test.go
Copy link
Copy Markdown
Contributor

@factory-droid factory-droid Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated 5 candidates: 3 are actionable and correctly anchored, and 2 were rejected because their anchors are outside changed diff hunks. The approved items cover concrete issues in waitForEndpointDeletion error/cancellation handling and a real acceptance-test flake risk from parallel writes to a shared global endpoint.

@github-actions github-actions Bot added the bug Something isn't working label May 4, 2026
@nimiyajoseph nimiyajoseph requested a review from Copilot May 4, 2026 12:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.

Comment thread internal/resources/app_endpoint.go
Comment thread internal/resources/app_endpoint.go
Comment thread acceptance_tests/app_endpoint_acceptance_test.go Outdated
Comment thread acceptance_tests/app_endpoint_acceptance_test.go Outdated
Comment thread acceptance_tests/app_endpoint_acceptance_test.go Outdated
Comment thread acceptance_tests/app_endpoint_acceptance_test.go Outdated
Comment thread acceptance_tests/app_endpoint_acceptance_test.go Outdated
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 4, 2026
@nimiyajoseph nimiyajoseph requested a review from Copilot May 4, 2026 13:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Comment thread internal/resources/app_endpoint.go Outdated
Comment thread internal/resources/app_endpoint.go Outdated
Comment thread acceptance_tests/app_endpoint.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 8 comments.

Comment thread internal/resources/app_endpoint.go Outdated
Comment thread internal/resources/app_endpoint.go Outdated
Comment thread acceptance_tests/app_endpoint_oidc_provider_acceptance_test.go Outdated
Comment thread acceptance_tests/app_endpoint_oidc_provider_acceptance_test.go
Comment thread acceptance_tests/app_endpoint_oidc_provider_acceptance_test.go
Comment thread acceptance_tests/app_endpoint_cors_acceptance_test.go Outdated
Comment thread acceptance_tests/app_endpoint_import_filter_acceptance_test.go
nimiyajoseph and others added 2 commits May 4, 2026 19:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Comment thread acceptance_tests/globals.go Outdated
Comment thread acceptance_tests/endpoint_setup.go
Comment thread acceptance_tests/app_endpoint.go Outdated
Comment thread acceptance_tests/app_endpoint.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@nimiyajoseph nimiyajoseph requested a review from Copilot May 7, 2026 15:11
@nimiyajoseph nimiyajoseph force-pushed the AV-127654-acceptance-test-for-app-end-points branch from 3d0dcb4 to dfd1361 Compare May 7, 2026 15:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread acceptance_tests/setup_test.go
@nimiyajoseph nimiyajoseph force-pushed the AV-127654-acceptance-test-for-app-end-points branch from dfd1361 to 492e36b Compare May 7, 2026 15:23
@nimiyajoseph nimiyajoseph force-pushed the AV-127654-acceptance-test-for-app-end-points branch from 492e36b to bd6d54f Compare May 7, 2026 16:17
…er/app service/bucket/endpoint under the existing project
…er/app service/bucket/endpoint under the existing project
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Comment thread internal/resources/app_endpoint.go Outdated
Comment thread internal/resources/app_endpoint.go Outdated
Comment thread internal/resources/app_endpoint.go Outdated
Comment thread internal/resources/app_endpoint.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Comment thread acceptance_tests/endpoint_setup.go
Comment thread acceptance_tests/endpoint_setup.go
@nimiyajoseph nimiyajoseph requested a review from IsaacLambat May 7, 2026 19:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Comment thread acceptance_tests/endpoint_setup.go
Copy link
Copy Markdown
Contributor

@stanleefdz stanleefdz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nimiyajoseph nimiyajoseph merged commit 0334801 into main May 11, 2026
20 checks passed
@nimiyajoseph nimiyajoseph deleted the AV-127654-acceptance-test-for-app-end-points branch May 11, 2026 05:33
matty271828 added a commit that referenced this pull request May 12, 2026
* main:
  [AV-129819] Add build time generator to parse enums from open-api spec (#581)
  [AV-130261] Fix the ConfigurationType non-pointer field (#588)
  [AV-127654] Add comprehensive acceptance tests for app_endpoint resource (#578)
matty271828 added a commit that referenced this pull request May 12, 2026
* main:
  [AV-129819] Add build time generator to parse enums from open-api spec (#581)
  [AV-130261] Fix the ConfigurationType non-pointer field (#588)
  [AV-127654] Add comprehensive acceptance tests for app_endpoint resource (#578)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants