Add secondary test user (#1186)
## Description Wire up code to fetch secondary user from config/env and also provide it to tests. ## Type of change <!--- Please check the type of change your PR introduces: ---> - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [x] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) * closes #1185 merge after to ensure automatic cleanup: * #1193 ## Test Plan <!-- How will this be tested prior to merging.--> - [x] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
b752d1da8d
commit
4800904b04
@ -22,13 +22,15 @@ const (
|
|||||||
// M365 config
|
// M365 config
|
||||||
TestCfgAzureTenantID = "azure_tenantid"
|
TestCfgAzureTenantID = "azure_tenantid"
|
||||||
TestCfgUserID = "m365userid"
|
TestCfgUserID = "m365userid"
|
||||||
|
TestCfgSecondaryUserID = "secondarym365userid"
|
||||||
TestCfgAccountProvider = "account_provider"
|
TestCfgAccountProvider = "account_provider"
|
||||||
)
|
)
|
||||||
|
|
||||||
// test specific env vars
|
// test specific env vars
|
||||||
const (
|
const (
|
||||||
EnvCorsoM365TestUserID = "CORSO_M356_TEST_USER_ID"
|
EnvCorsoM365TestUserID = "CORSO_M356_TEST_USER_ID"
|
||||||
EnvCorsoTestConfigFilePath = "CORSO_TEST_CONFIG_FILE"
|
EnvCorsoSecondaryM365TestUserID = "CORSO_SECONDARY_M356_TEST_USER_ID"
|
||||||
|
EnvCorsoTestConfigFilePath = "CORSO_TEST_CONFIG_FILE"
|
||||||
)
|
)
|
||||||
|
|
||||||
// global to hold the test config results.
|
// global to hold the test config results.
|
||||||
@ -108,6 +110,13 @@ func readTestConfig() (map[string]string, error) {
|
|||||||
vpr.GetString(TestCfgUserID),
|
vpr.GetString(TestCfgUserID),
|
||||||
"lidiah@8qzvrj.onmicrosoft.com",
|
"lidiah@8qzvrj.onmicrosoft.com",
|
||||||
)
|
)
|
||||||
|
fallbackTo(
|
||||||
|
testEnv,
|
||||||
|
TestCfgSecondaryUserID,
|
||||||
|
os.Getenv(EnvCorsoSecondaryM365TestUserID),
|
||||||
|
vpr.GetString(TestCfgSecondaryUserID),
|
||||||
|
"lynner@8qzvrj.onmicrosoft.com",
|
||||||
|
)
|
||||||
|
|
||||||
testEnv[EnvCorsoTestConfigFilePath] = os.Getenv(EnvCorsoTestConfigFilePath)
|
testEnv[EnvCorsoTestConfigFilePath] = os.Getenv(EnvCorsoTestConfigFilePath)
|
||||||
testConfig = testEnv
|
testConfig = testEnv
|
||||||
|
|||||||
@ -16,3 +16,15 @@ func M365UserID(t *testing.T) string {
|
|||||||
|
|
||||||
return cfg[TestCfgUserID]
|
return cfg[TestCfgUserID]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SecondaryM365UserID returns an userID string representing the m365UserID
|
||||||
|
// described by either the env var CORSO_SECONDARY_M356_TEST_USER_ID, the
|
||||||
|
// corso_test.toml config file or the default value (in that order of priority).
|
||||||
|
// The default is a last-attempt fallback that will only work on alcion's
|
||||||
|
// testing org.
|
||||||
|
func SecondaryM365UserID(t *testing.T) string {
|
||||||
|
cfg, err := readTestConfig()
|
||||||
|
require.NoError(t, err, "retrieving secondary m365 user id from test configuration")
|
||||||
|
|
||||||
|
return cfg[TestCfgSecondaryUserID]
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user