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

Nil Pointer exception while trying to reach out via Harness SDK during Terratest #119

Open
arimaverick opened this issue May 13, 2022 · 2 comments

Comments

@arimaverick
Copy link

I am testing harness terraform module in Jenkins. I am able to perform the terraform execution part, but while reaching out to client sdk to validate few properties I am facing the following error:

**panic: runtime error: invalid memory address or nil pointer dereference [recovered]
              panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xcef4c1]**

goroutine 19 [running]:
testing.tRunner.func1.2(0xdb4ee0, 0x1565770)
              /usr/share/go/src/testing/testing.go:1144 +0x332
testing.tRunner.func1(0xc000102d80)
              /usr/share/go/src/testing/testing.go:1147 +0x4b6
panic(0xdb4ee0, 0x1565770)
              /usr/share/go/src/runtime/panic.go:965 +0x1b9
test/unit.TestHarnessK8sCloudProvider(0xc000102d80)
              **/tmp/workspace/xxxx/provider_test.go:72** +0x661
testing.tRunner(0xc000102d80, 0xf00748)
              /usr/share/go/src/testing/testing.go:1194 +0xef
created by testing.(*T).Run
              /usr/share/go/src/testing/testing.go:1239 +0x2b3

Line# 72 in the code is the following one:
require.Equal(t, client.Configuration.AccountId, "AbcxYz1234", "FAILED: AccountID does NOT match")

The code for client config is the following. I have set env vars HARNESSS_ACCOUNT_ID and HARNESS_API_KEY:

client, _ := cd.NewClient(&cd.Config{
                             AccountId:          helpers.EnvVars.AccountId.Get(),
                             APIKey:     helpers.EnvVars.ApiKey.Get(),
                             DebugLogging: true,
              })

I would like to know if there is additional instruction to set network config to reach out to the harness sdk. Kindly help us to get the way forward here.

Thank you.
@abrahamkoshy

@arimaverick arimaverick changed the title Nil Point exception while trying to reach out via Harness SDK during Terratest Nil Pointer exception while trying to reach out via Harness SDK during Terratest May 17, 2022
@micahlmartin
Copy link
Collaborator

@arimaverick That should be working. I'm not able to reproduce this on my end.

@lukaszfedorko
Copy link

@micahlmartin I think it's due to client not initialized correctly. According to a documentation here:

https://github.com/harness/harness-go-sdk more parameters have to be passed.

Can you explain where can I get getUserAgentString() from?

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

No branches or pull requests

3 participants