-
Notifications
You must be signed in to change notification settings - Fork 123
Refactor all Kibana connector acceptance tests to use ConfigDirectory pattern #1484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: dimuon <8962171+dimuon@users.noreply.github.com>
Co-authored-by: dimuon <8962171+dimuon@users.noreply.github.com>
| }) | ||
| } | ||
|
|
||
| func TestAccResourceKibanaConnectorBedrock(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot , restructure this test file to be consistent with this pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in f5b838e. Restructured to use ConfigDirectory and ConfigVariables pattern with testdata files, matching the fleet integration test structure.
Co-authored-by: dimuon <8962171+dimuon@users.noreply.github.com>
|
@copilot refactor all the tests in
|
Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
Done in 7bb50da. All tests now use ConfigDirectory pattern with external terraform files:
All acceptance tests pass (24.7s total runtime). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors all Kibana connector acceptance tests to use external Terraform configuration files with the ConfigDirectory and ConfigVariables pattern, following the same approach previously established in fleet integration tests.
Key Changes
- Consolidated
TestAccResourceKibanaConnectorBedrockandTestAccResourceKibanaConnectorGenAiinto a single table-driven testTestAccResourceKibanaConnectorAI - Migrated inline Terraform configuration strings to external
.tffiles organized intestdata/subdirectories - Implemented
ConfigDirectoryandConfigVariablespattern across all connector acceptance tests
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/kibana/connectors/acc_test.go |
Refactored test functions to use external configs and table-driven patterns, eliminating inline Terraform strings |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorAI/bedrock/create/connector.tf |
External config for bedrock connector creation test |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorAI/bedrock/update/connector.tf |
External config for bedrock connector update test |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorAI/gen-ai/create/connector.tf |
External config for gen-ai connector creation test |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorAI/gen-ai/update/connector.tf |
External config for gen-ai connector update test |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorCasesWebhook/with_empty_connector_id/create/connector.tf |
External config for cases webhook connector creation without predefined ID |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorCasesWebhook/with_empty_connector_id/update/connector.tf |
External config for cases webhook connector update without predefined ID |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorCasesWebhook/with_predefined_connector_id/create/connector.tf |
External config for cases webhook connector creation with predefined ID |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorCasesWebhook/with_predefined_connector_id/update/connector.tf |
External config for cases webhook connector update with predefined ID |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorIndex/create/connector.tf |
External config for index connector creation test |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorIndex/update/connector.tf |
External config for index connector update test |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorFromSDK/connector.tf |
External config for SDK-based connector test |
internal/kibana/connectors/testdata/TestAccResourceKibanaConnectorEmptyConfigFromSDK/connector.tf |
External config for SDK-based empty config connector test |
| variable "connector_name" { | ||
| description = "The connector name" | ||
| type = string | ||
| } |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All test configuration files define the same connector_name variable with identical description and type. Consider creating a shared variables file to eliminate this duplication across 13 test configuration files.
| "connector_name": config.StringVariable(connectorName), | ||
| }, | ||
| Check: resource.ComposeTestCheckFunc( | ||
| append([]resource.TestCheckFunc{testCommonAttributes(connectorName, tc.connectorTypeID)}, tc.createChecks...)..., |
Copilot
AI
Nov 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The pattern of appending testCommonAttributes to check functions could be simplified by having tc.createChecks and tc.updateChecks include all necessary checks. This would eliminate the need for the append operation and make the test structure clearer.
… pattern (#1484) * Initial plan * Refactor AI connector tests into table-driven test Co-authored-by: dimuon <8962171+dimuon@users.noreply.github.com> * Fix regex pattern for secret field in bedrock update checks Co-authored-by: dimuon <8962171+dimuon@users.noreply.github.com> * Restructure test to use ConfigDirectory pattern with testdata files Co-authored-by: dimuon <8962171+dimuon@users.noreply.github.com> * Refactor all connector acceptance tests to use ConfigDirectory pattern Co-authored-by: tobio <444668+tobio@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dimuon <8962171+dimuon@users.noreply.github.com> Co-authored-by: tobio <444668+tobio@users.noreply.github.com>
…ata-view-resource * origin/main: (32 commits) chore(deps): update kibana-openapi-spec digest to c99d51c (#1487) [Feature] Introduce elasticsearch alias resource with atomic write index management and nested attributes (#1343) Support setting solution for 8.16+ on Cloud (#1486) Refactor all Kibana connector acceptance tests to use ConfigDirectory pattern (#1484) Support .bedrock and .gen-ai connectors (#1467) Bump golang.org/x/crypto from 0.41.0 to 0.45.0 in /libs/go-kibana-rest (#1481) Bump golang.org/x/crypto from 0.42.0 to 0.45.0 (#1480) fix(deps): update module github.com/go-resty/resty/v2 to v2.17.0 (#1478) chore(deps): update kibana-openapi-spec digest to f1d0789 (#1479) chore(deps): update kibana-openapi-spec digest to 5841714 (#1477) chore(deps): update golang:1.25.4 docker digest to 6981837 (#1476) chore(deps): update kibana-openapi-spec digest to 67de5ef (#1475) chore(deps): update golangci/golangci-lint-action digest to e7fa5ac (#1474) chore(deps): update kibana-openapi-spec digest to b4553b6 (#1472) chore(deps): update actions/checkout action to v6 (#1470) Support publishing experimental resources/datasources within the framework provider (#1464) chore(deps): update actions/setup-go digest to 4dc6199 (#1466) fix(deps): update module github.com/elastic/elastic-transport-go/v8 to v8.8.0 (#1459) Prepare 0.12.2 Release (#1458) Support spaces for detection rules (#1457) ...
Follow-up to #1467. Refactored all Kibana connector acceptance tests to use the
ConfigDirectoryandConfigVariablespattern, consistent with fleet integration tests.Changes
All acceptance tests in
internal/kibana/connectors/acc_test.gonow use external Terraform configuration files:TestAccResourceKibanaConnectorBedrockandTestAccResourceKibanaConnectorGenAiinto table-driven testStructure
Test configurations are organized in
testdata/directories:testdata/TestAccResourceKibanaConnectorAI/{bedrock,gen-ai}/{create,update}/connector.tftestdata/TestAccResourceKibanaConnectorCasesWebhook/{with_empty_connector_id,with_predefined_connector_id}/{create,update}/connector.tftestdata/TestAccResourceKibanaConnectorIndex/{create,update}/connector.tftestdata/TestAccResourceKibanaConnectorFromSDK/connector.tftestdata/TestAccResourceKibanaConnectorEmptyConfigFromSDK/connector.tfTest Results
All acceptance tests pass (24.7s total runtime):
Code Reduction
Test execution logic is now separated from test data, with Terraform configurations in external files and test assertions in table-driven structures.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.