Skip to content

Conversation

hashimoon
Copy link
Contributor

@hashimoon hashimoon commented Sep 6, 2025

Description

[BETA] This adds support for Registry Module tests to run on custom Agents.

AgentExecutionMode: remote | agent
AgentPoolID: string | nil

Testing plan

  1. Create a VCS backed Registry Module
  2. Enable testing
  3. Create a custom agent pool
  4. Update the TestConfig.AgentExecutionMode to agent
  5. Update the TestConfig.AgentPoolID to the custom agent pool ID
  6. Create a test run and verify the tests run on the custom agent pool ID

External links

Output from tests

Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.

➜  go-tfe git:(hashimoon/TF-27882-agent-pool) ✗     ENABLE_BETA=1 GITHUB_REGISTRY_MODULE_IDENTIFIER=hashimoon/terraform-module-random-test OAUTH_CLIENT_GITHUB_TOKEN=xxx TFE_ADDRESS=xxx  TFE_TOKEN=xxx  go test -run "TestRegistryModulesUpdate_AgentExecutionValidation" -v -timeout=2m

=== RUN   TestRegistryModulesUpdate_AgentExecutionValidation
=== RUN   TestRegistryModulesUpdate_AgentExecutionValidation/errors_when_remote_execution_mode_has_agent_pool_ID
=== RUN   TestRegistryModulesUpdate_AgentExecutionValidation/succeeds_when_agent_execution_mode_has_agent_pool_ID
=== RUN   TestRegistryModulesUpdate_AgentExecutionValidation/succeeds_when_remote_execution_mode_has_no_agent_pool_ID
--- PASS: TestRegistryModulesUpdate_AgentExecutionValidation (4.63s)
    --- PASS: TestRegistryModulesUpdate_AgentExecutionValidation/errors_when_remote_execution_mode_has_agent_pool_ID (0.00s)
    --- PASS: TestRegistryModulesUpdate_AgentExecutionValidation/succeeds_when_agent_execution_mode_has_agent_pool_ID (0.10s)
    --- PASS: TestRegistryModulesUpdate_AgentExecutionValidation/succeeds_when_remote_execution_mode_has_no_agent_pool_ID (0.09s)
PASS
ok  	github.com/hashicorp/go-tfe	4.889s

...

➜  go-tfe git:(hashimoon/TF-27882-agent-pool) ✗ ENABLE_BETA=1 GITHUB_REGISTRY_MODULE_IDENTIFIER=xxxOAUTH_CLIENT_GITHUB_TOKEN=xxx TFE_ADDRESS=xxx TFE_TOKEN=xxx go test -run "TestRegistryModules.*AgentExecutionValidation" -v
=== RUN   TestRegistryModulesUpdate_AgentExecutionValidation
    helper_test.go:1007: Failed to create organization: unauthorized
--- FAIL: TestRegistryModulesUpdate_AgentExecutionValidation (0.14s)
=== RUN   TestRegistryModulesCreateWithVCSConnection_AgentExecutionValidation
    helper_test.go:1007: Failed to create organization: unauthorized
--- FAIL: TestRegistryModulesCreateWithVCSConnection_AgentExecutionValidation (0.13s)
=== RUN   TestRegistryModules_Update_AgentExecutionValidation
=== RUN   TestRegistryModules_Update_AgentExecutionValidation/errors_when_remote_execution_mode_has_agent_pool_ID
=== RUN   TestRegistryModules_Update_AgentExecutionValidation/succeeds_when_agent_execution_mode_has_agent_pool_ID
=== RUN   TestRegistryModules_Update_AgentExecutionValidation/succeeds_when_remote_execution_mode_has_no_agent_pool_ID
--- PASS: TestRegistryModules_Update_AgentExecutionValidation (0.00s)
    --- PASS: TestRegistryModules_Update_AgentExecutionValidation/errors_when_remote_execution_mode_has_agent_pool_ID (0.00s)
    --- PASS: TestRegistryModules_Update_AgentExecutionValidation/succeeds_when_agent_execution_mode_has_agent_pool_ID (0.00s)
    --- PASS: TestRegistryModules_Update_AgentExecutionValidation/succeeds_when_remote_execution_mode_has_no_agent_pool_ID (0.00s)
=== RUN   TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation
=== RUN   TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/errors_when_remote_execution_mode_has_agent_pool_ID
=== RUN   TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/succeeds_when_agent_execution_mode_has_agent_pool_ID
=== RUN   TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/succeeds_when_remote_execution_mode_has_no_agent_pool_ID
=== RUN   TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/succeeds_when_TestConfig_is_nil
--- PASS: TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation (0.00s)
    --- PASS: TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/errors_when_remote_execution_mode_has_agent_pool_ID (0.00s)
    --- PASS: TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/succeeds_when_agent_execution_mode_has_agent_pool_ID (0.00s)
    --- PASS: TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/succeeds_when_remote_execution_mode_has_no_agent_pool_ID (0.00s)
    --- PASS: TestRegistryModules_CreateWithVCSConnection_AgentExecutionValidation/succeeds_when_TestConfig_is_nil (0.00s)
FAIL
exit status 1
FAIL	github.com/hashicorp/go-tfe	0.528s

Rollback Plan

Changes to Security Controls

@hashimoon hashimoon requested a review from a team as a code owner September 6, 2025 00:03
@hashimoon hashimoon force-pushed the hashimoon/TF-27882-agent-pool branch from c68c653 to cfc48fd Compare September 6, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant