在使用Github Actions执行terratest时,会出现“无效字符’c’,寻找值的开始”并导致测试失败
现场情况
当地运行正常。
即使在Github Actions中,也可以使用go test命令执行。
go test -v -timeout 30m
信息
| TestTerraformAwsCloudFrontCustomDomain 2022-11-25T08:12:43Z logger.go:66: ::set-output name=exitcode::0
| output.go:19:
| Error Trace: /home/yuta/terraform/aws/infra/test/output.go:19
| /home/yuta/terraform/aws/infra/test/custom_header_test.go:49
| /home/yuta/terraform/aws/infra/test/custom_header_test.go:38
| Error: Received unexpected error:
| invalid character 'c' looking for beginning of value
| Test: TestTerraformAwsCloudFrontCustomDomain
| --- FAIL: TestTerraformAwsCloudFrontCustomDomain (499.91s)
| FAIL
| exit status 1
| FAIL test 499.914s
应对方式
在中国的土地改造中,不需要使用terraform_wrapper: false参数。
steps:
- uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
请参考
https://github.com/gruntwork-io/terratest/issues/706:
https://github.com/gruntwork-io/terratest/issues/779: