hashicorp / hashicorp/terraform-exec

Occasional test failures due to timeout on registry request

Open
#126 0 comments 0 reactions 0 assignees View on GitHub
bug needs investigation upstream/terraform
Dominant language
Go
Stars
786
Forks
129
PR merge metrics
No merged PRs in 30d

Description

The fix for this may well be in Core or the registry, but filing here for now.

Tests runs occasionally fail with a `Failed to query available provider packages` error like the following:
```
=== RUN TestStateMv/basic_with_state-0.14.4
util_test.go:111: [INFO] running Terraform command: /tmp/tfinstall187681955/v-0.14.4/terraform init -no-color -force-copy -input=false -lock-timeout=0s -backend=true -get=true -upgrade=false -lock=true -get-plugins=true -verify-plugins=true
state_mv_test.go:23: error running Init in test directory: exit status 1

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/null:
could not connect to registry.terraform.io: Failed to request discovery
document: Get "https://registry.terraform.io/.well-known/terraform.json":
net/http: request canceled while waiting for connection (Client.Timeout
exceeded while awaiting headers)

--- FAIL: TestStateMv (13.12s)
--- SKIP: TestStateMv/basic_with_state-0.11.14 (0.23s)
--- SKIP: TestStateMv/basic_with_state-0.12.30 (0.47s)
--- PASS: TestStateMv/basic_with_state-0.13.6 (1.12s)
--- FAIL: TestStateMv/basic_with_state-0.14.4 (11.31s)
```

Example failing test run: https://app.circleci.com/pipelines/github/hashicorp/terraform-exec/661/workflows/bdc5a99c-63da-4f12-ad66-52df573f600c/jobs/9510

The tests pass when rerun.

More examples needed, but suspect this can happen during any test that runs `terraform init`.

Contributor guide

Open the contributing guide

Research direction

Start with the failing integration test in state_mv_test.go and the command-running details in util_test.go. Run or review tests that invoke terraform init, using the linked CircleCI failure as a reference, and compare reruns to determine whether the timeout is in terraform-exec, Terraform Core, or the registry. Done means the failure cause is identified and a reliable fix or test-handling change is specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, terraform
Domain
networking, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.