Skip to content
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

Solved: Issue found in end-to-end-testing golang error: dial tcp: lookup "<ip>": no such host #215

Open
1 task done
heriberto-mb opened this issue Apr 18, 2023 · 0 comments
Labels
bug Something isn't working example

Comments

@heriberto-mb
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Example Name

https://github.com/Azure/terraform/blob/master/samples/end-to-end-testing/src/test/end2end_test.go#L78

Terraform Version

1.3.8

Current Behavior

@jcorioland
There is an issue when the code generates the connection to the public ip.
In the following line, it tries to connect to the public ip address:

https://github.com/Azure/terraform/blob/master/samples/end-to-end-testing/src/test/end2end_test.go#L78

After several days of troubleshooting the code, I found that it fails because the variable not only contains the ip address, but it also includes double quotes around the ip address, this makes it fail.

Expected Behavior

Finally fixed it by using the following change:

//sshConnection, err := ssh.Dial("tcp", fmt.Sprintf("%s:22", vmLinux1PublicIPAddress), sshConfig)
sshConnection, err := ssh.Dial("tcp", fmt.Sprintf("%s:22", strings.Trim(vmLinux1PublicIPAddress, "\"")), sshConfig)

Once that adjustment was done, the code worked!

Steps To Reproduce

cd /c/git/terraform/samples/end-to-end-testing/src/test
az login --use-device-code
az account set --subscription Playground
cd ~/.ssh
ssh-keygen.exe #This is in test, not definitive yet: -m PEM
make sure id_rsa and id_rsa.pub were created
ls -l /.ssh/id_rsa*
export TEST_SSH_KEY_PATH="
/.ssh/id_rsa"
cd /c/git/terraform/samples/end-to-end-testing/src/test
go mod download github.com/gruntwork-io/terratest
go mod download github.com/Azure/go-autorest/autorest
go mod tidy -e
go test -v ./ -timeout 10m

Anything else?

No response

@heriberto-mb heriberto-mb added bug Something isn't working example labels Apr 18, 2023
@heriberto-mb heriberto-mb changed the title Issue found in end-to-end-testing Solved: Issue found in end-to-end-testing golang error: dial tcp: lookup "<ip>": no such host Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working example
Projects
None yet
Development

No branches or pull requests

1 participant