Fix sanity test backup arg for Groups (#4508)
<!-- PR description--> --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [x] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * #<issue> #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [ ] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
c0cd7cf2f6
commit
a2e882b7f7
4
.github/workflows/sanity-test.yaml
vendored
4
.github/workflows/sanity-test.yaml
vendored
@ -385,8 +385,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
service: groups
|
service: groups
|
||||||
kind: incremental
|
kind: incremental
|
||||||
backup-args: '--site "${{ vars.CORSO_M365_TEST_GROUPS_SITE_URL }}"'
|
backup-args: '--group "${{ vars.CORSO_M365_TEST_TEAM_ID }}"'
|
||||||
restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}'
|
restore-args: '--site "${{ vars.CORSO_M365_TEST_GROUPS_SITE_URL }}" --folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}'
|
||||||
restore-container: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}'
|
restore-container: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}'
|
||||||
log-dir: ${{ env.CORSO_LOG_DIR }}
|
log-dir: ${{ env.CORSO_LOG_DIR }}
|
||||||
with-export: true
|
with-export: true
|
||||||
|
|||||||
@ -31,6 +31,7 @@ type Envs struct {
|
|||||||
GroupID string
|
GroupID string
|
||||||
SiteID string
|
SiteID string
|
||||||
UserID string
|
UserID string
|
||||||
|
TeamSiteID string
|
||||||
}
|
}
|
||||||
|
|
||||||
func EnvVars(ctx context.Context) Envs {
|
func EnvVars(ctx context.Context) Envs {
|
||||||
@ -43,6 +44,7 @@ func EnvVars(ctx context.Context) Envs {
|
|||||||
GroupID: tconfig.GetM365TeamID(ctx),
|
GroupID: tconfig.GetM365TeamID(ctx),
|
||||||
SiteID: tconfig.GetM365SiteID(ctx),
|
SiteID: tconfig.GetM365SiteID(ctx),
|
||||||
UserID: tconfig.GetM365UserID(ctx),
|
UserID: tconfig.GetM365UserID(ctx),
|
||||||
|
TeamSiteID: tconfig.GetM365TeamSiteID(ctx),
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(os.Getenv(sanityTestUser)) > 0 {
|
if len(os.Getenv(sanityTestUser)) > 0 {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ func CheckGroupsExport(
|
|||||||
// assumes we only need to sanity check the default site.
|
// assumes we only need to sanity check the default site.
|
||||||
// should we expand this to check all sites in the group?
|
// should we expand this to check all sites in the group?
|
||||||
// are we backing up / restoring more than the default site?
|
// are we backing up / restoring more than the default site?
|
||||||
drive, err := ac.Sites().GetDefaultDrive(ctx, envs.SiteID)
|
drive, err := ac.Sites().GetDefaultDrive(ctx, envs.TeamSiteID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
common.Fatal(ctx, "getting the drive:", err)
|
common.Fatal(ctx, "getting the drive:", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ func CheckGroupsRestoration(
|
|||||||
ac api.Client,
|
ac api.Client,
|
||||||
envs common.Envs,
|
envs common.Envs,
|
||||||
) {
|
) {
|
||||||
drive, err := ac.Sites().GetDefaultDrive(ctx, envs.SiteID)
|
drive, err := ac.Sites().GetDefaultDrive(ctx, envs.TeamSiteID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
common.Fatal(ctx, "getting site's default drive:", err)
|
common.Fatal(ctx, "getting site's default drive:", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ const (
|
|||||||
TestCfgSiteID = "m365siteid"
|
TestCfgSiteID = "m365siteid"
|
||||||
TestCfgSiteURL = "m365siteurl"
|
TestCfgSiteURL = "m365siteurl"
|
||||||
TestCfgTeamID = "m365teamid"
|
TestCfgTeamID = "m365teamid"
|
||||||
|
TestCfgTeamSiteID = "m365teamsiteid"
|
||||||
TestCfgGroupID = "m365groupid"
|
TestCfgGroupID = "m365groupid"
|
||||||
TestCfgUserID = "m365userid"
|
TestCfgUserID = "m365userid"
|
||||||
TestCfgSecondaryUserID = "secondarym365userid"
|
TestCfgSecondaryUserID = "secondarym365userid"
|
||||||
@ -47,6 +48,7 @@ const (
|
|||||||
EnvCorsoM365TestSiteID = "CORSO_M365_TEST_SITE_ID"
|
EnvCorsoM365TestSiteID = "CORSO_M365_TEST_SITE_ID"
|
||||||
EnvCorsoM365TestSiteURL = "CORSO_M365_TEST_SITE_URL"
|
EnvCorsoM365TestSiteURL = "CORSO_M365_TEST_SITE_URL"
|
||||||
EnvCorsoM365TestTeamID = "CORSO_M365_TEST_TEAM_ID"
|
EnvCorsoM365TestTeamID = "CORSO_M365_TEST_TEAM_ID"
|
||||||
|
EnvCorsoM365TestTeamSiteID = "CORSO_M365_TEST_TEAM_SITE_ID"
|
||||||
EnvCorsoSecondaryM365TestTeamID = "CORSO_SECONDARY_M365_TEST_TEAM_ID"
|
EnvCorsoSecondaryM365TestTeamID = "CORSO_SECONDARY_M365_TEST_TEAM_ID"
|
||||||
EnvCorsoM365TestGroupID = "CORSO_M365_TEST_GROUP_ID"
|
EnvCorsoM365TestGroupID = "CORSO_M365_TEST_GROUP_ID"
|
||||||
EnvCorsoSecondaryM365TestGroupID = "CORSO_SECONDARY_M365_TEST_GROUP_ID"
|
EnvCorsoSecondaryM365TestGroupID = "CORSO_SECONDARY_M365_TEST_GROUP_ID"
|
||||||
@ -165,6 +167,12 @@ func ReadTestConfig() (map[string]string, error) {
|
|||||||
os.Getenv(EnvCorsoM365TestTeamID),
|
os.Getenv(EnvCorsoM365TestTeamID),
|
||||||
vpr.GetString(TestCfgTeamID),
|
vpr.GetString(TestCfgTeamID),
|
||||||
"6f24b40d-b13d-4752-980f-f5fb9fba7aa0")
|
"6f24b40d-b13d-4752-980f-f5fb9fba7aa0")
|
||||||
|
fallbackTo(
|
||||||
|
testEnv,
|
||||||
|
TestCfgTeamSiteID,
|
||||||
|
os.Getenv(EnvCorsoM365TestTeamSiteID),
|
||||||
|
vpr.GetString(TestCfgTeamSiteID),
|
||||||
|
"8df7082a-62eb-4165-97f9-ead8cf04c0d8,11810f05-e8bd-45e2-9728-92e434260750")
|
||||||
fallbackTo(
|
fallbackTo(
|
||||||
testEnv,
|
testEnv,
|
||||||
TestCfgSecondaryTeamID,
|
TestCfgSecondaryTeamID,
|
||||||
|
|||||||
@ -222,6 +222,20 @@ func GetM365TeamID(ctx context.Context) string {
|
|||||||
return strings.ToLower(cfg[TestCfgTeamID])
|
return strings.ToLower(cfg[TestCfgTeamID])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetM365TeamSiteID returns a site ID string representing the m365TeamSiteID
|
||||||
|
// described by either the env var CORSO_M365_TEST_TEAM_SITE_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 GetM365TeamSiteID(ctx context.Context) string {
|
||||||
|
cfg, err := ReadTestConfig()
|
||||||
|
if err != nil {
|
||||||
|
logger.Ctx(ctx).Error(err, "retrieving m365 team id from test configuration")
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.ToLower(cfg[TestCfgTeamSiteID])
|
||||||
|
}
|
||||||
|
|
||||||
// UnlicensedM365UserID returns an userID string representing the m365UserID
|
// UnlicensedM365UserID returns an userID string representing the m365UserID
|
||||||
// described by either the env var CORSO_M365_TEST_UNLICENSED_USER, the
|
// described by either the env var CORSO_M365_TEST_UNLICENSED_USER, the
|
||||||
// corso_test.toml config file or the default value (in that order of priority).
|
// corso_test.toml config file or the default value (in that order of priority).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user