Read origin from config - #2084
Conversation
Co-authored-by: Pavel Busko <busko.pavel@gmail.com>
iaftab-alam
left a comment
There was a problem hiding this comment.
The GetUserOrigin() and GetAdminOrigin() were changed from returning a hardcoded empty string to dereferencing c.Origin, but getDefaults() was never updated to initialise it. Any config without "origin" (which is every existing config) leaves c.Origin == nil and both getters panic immediately at suite startup — before a single test runs.
Have you ran this change againts a vanilla cf?
I just confirmed with a real run when omitting the origin as config: all 12 parallel nodes hit runtime error: invalid memory address or nil pointer dereference at config_struct.go:957, 0 of 286 specs executed. Little more logs:
runtime error: invalid memory address or nil pointer dereference
Full Stack Trace
github.com/cloudfoundry/cf-acceptance-tests/helpers/config.(*config).GetUserOrigin(0x1072dd5?)
/tmp/build/5bf5abc4/cf-acceptance-tests-repo/helpers/config/config_struct.go:957 +0x4
github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers/internal.NewTestUser({0x7f5af8ff9ed8, 0xf05a078e008}, {0x10ea720, 0xf05a0c2e620})
/tmp/build/5bf5abc4/cf-acceptance-tests-repo/vendor/github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers/internal/user.go:67 +0xdf
github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers.NewTestContextSuiteSetup({0x7f5af8ff9da0, 0xf05a078e008}, {0x10f9c80, 0xf05a0b76000}, 0x0)
/tmp/build/5bf5abc4/cf-acceptance-tests-repo/vendor/github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers/test_suite_setup.go:77 +0xff
github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers.NewTestSuiteSetup({0x7f5af8ff9da0, 0xf05a078e008})
/tmp/build/5bf5abc4/cf-acceptance-tests-repo/vendor/github.com/cloudfoundry/cf-test-helpers/v2/workflowhelpers/test_suite_setup.go:54 +0x7f
github.com/cloudfoundry/cf-acceptance-tests_test.init.func2({0x0?, 0x0?, 0x0?})
/tmp/build/5bf5abc4/cf-acceptance-tests-repo/cats_suite_test.go:136 +0x93
reflect.Value.call({0xecbdc0?, 0x10dc230?, 0x13?}, {0x1072f0d, 0x4}, {0xf05a0c20660, 0x1, 0x1?})
/usr/local/go/src/reflect/value.go:586 +0xf0c
reflect.Value.Call({0xecbdc0?, 0x10dc230?, 0x0?}, {0xf05a0c20660?, 0x106fea0?, 0x0?})
/usr/local/go/src/reflect/value.go:369 +0xb9
------------------------------
Summarizing 12 Failures:
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
[PANICKED!] [SynchronizedBeforeSuite]
/usr/local/go/src/runtime/panic.go:336
Ran 0 of 286 Specs in 7.400 seconds
FAIL! -- A BeforeSuite node failed so all tests were skipped.
Ginkgo ran 1 suite in 34.230505834s
Test Suite Failed
exit status 1
/tmp/build/5bf5abc4
This should be set to empty string, when it is not specified, then CF uses the deployment's configured default when authenticating.
lastly, the code says this origin config is mandatory but the readme says its recommended however if the default is now set to empty string it will become optional? Can you please clarify this and adjust it accordingly.
|
Hi @iaftab-alam, The value is optional and the |
iaftab-alam
left a comment
There was a problem hiding this comment.
Sweet! All green can be merged...Thanks for accommodating the feedback
Are you submitting this PR against the develop branch?
All PR's to CATs should be submitted to develop and will be merged to main once they've passed acceptance.
What is this change about?
This change adds the config parameter 'origin' that needs to be set whenever not the default identity provider should be used.
Please provide contextual information.
This was somehow added to the smoke tests years ago. but somehow never added to cats.
see cloudfoundry/cf-smoke-tests@056ece1
What version of cf-deployment have you run this cf-acceptance-test change against?
Include any links to other PRs, stories, slack discussions, etc... that will help establish context.
What version of cf-deployment have you run this cf-acceptance-test change against?
v60.1.0
Please check all that apply for this PR:
Did you update the README as appropriate for this change?
If you are introducing a new acceptance test, what is your rationale for including it CATs rather than your own acceptance test suite?
CATs should validate common operator workflows.
CATs is not a regression test suite.
CATs is run by every component team to validate their releases before promotion.
How many more (or fewer) seconds of runtime will this change introduce to CATs?
0s
What is the level of urgency for publishing this change?
Tag your pair, your PM, and/or team!
It's helpful to tag a few other folks on your team or your team alias in case we need to follow up later.
@pbusko