diff --git a/src/cli/backup/groups_e2e_test.go b/src/cli/backup/groups_e2e_test.go index 6d8a018d9..1d4be4a5c 100644 --- a/src/cli/backup/groups_e2e_test.go +++ b/src/cli/backup/groups_e2e_test.go @@ -32,6 +32,63 @@ var ( libraries = path.LibrariesCategory ) +// --------------------------------------------------------------------------- +// tests that require no existing backups +// --------------------------------------------------------------------------- + +type NoBackupGroupsE2ESuite struct { + tester.Suite + dpnd dependencies + its intgTesterSetup +} + +func TestNoBackupGroupsE2ESuite(t *testing.T) { + t.Skip("enable when e2e is complete for groups") + + suite.Run(t, &BackupGroupsE2ESuite{Suite: tester.NewE2ESuite( + t, + [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}, + )}) +} + +func (suite *NoBackupGroupsE2ESuite) SetupSuite() { + t := suite.T() + + ctx, flush := tester.NewContext(t) + defer flush() + + suite.its = newIntegrationTesterSetup(t) + suite.dpnd = prepM365Test(t, ctx) +} + +func (suite *NoBackupGroupsE2ESuite) TestGroupsBackupListCmd_noBackups() { + t := suite.T() + ctx, flush := tester.NewContext(t) + ctx = config.SetViper(ctx, suite.dpnd.vpr) + + defer flush() + + suite.dpnd.recorder.Reset() + + cmd := cliTD.StubRootCmd( + "backup", "list", "groups", + "--config-file", suite.dpnd.configFilePath) + cli.BuildCommandTree(cmd) + + cmd.SetErr(&suite.dpnd.recorder) + + ctx = print.SetRootCmd(ctx, cmd) + + // run the command + err := cmd.ExecuteContext(ctx) + require.NoError(t, err, clues.ToCore(err)) + + result := suite.dpnd.recorder.String() + + // as an offhand check: the result should contain the m365 group id + assert.True(t, strings.HasSuffix(result, "No backups available\n")) +} + // --------------------------------------------------------------------------- // tests with no prior backup // --------------------------------------------------------------------------- @@ -139,34 +196,6 @@ func runGroupsBackupGroupNotFoundTest(suite *BackupGroupsE2ESuite, category path t.Log("backup results", result) } -func (suite *BackupGroupsE2ESuite) TestGroupsBackupListCmd_empty() { - t := suite.T() - ctx, flush := tester.NewContext(t) - ctx = config.SetViper(ctx, suite.dpnd.vpr) - - defer flush() - - suite.dpnd.recorder.Reset() - - cmd := cliTD.StubRootCmd( - "backup", "list", "groups", - "--config-file", suite.dpnd.configFilePath) - cli.BuildCommandTree(cmd) - - cmd.SetErr(&suite.dpnd.recorder) - - ctx = print.SetRootCmd(ctx, cmd) - - // run the command - err := cmd.ExecuteContext(ctx) - require.NoError(t, err, clues.ToCore(err)) - - result := suite.dpnd.recorder.String() - - // as an offhand check: the result should contain the m365 group id - assert.True(t, strings.HasSuffix(result, "No backups available\n")) -} - func (suite *BackupGroupsE2ESuite) TestBackupCreateGroups_badAzureClientIDFlag() { t := suite.T() ctx, flush := tester.NewContext(t) diff --git a/src/cli/backup/teams_e2e_test.go b/src/cli/backup/teams_e2e_test.go index 2640a2b66..4dba95de7 100644 --- a/src/cli/backup/teams_e2e_test.go +++ b/src/cli/backup/teams_e2e_test.go @@ -27,6 +27,63 @@ import ( storeTD "github.com/alcionai/corso/src/pkg/storage/testdata" ) +// --------------------------------------------------------------------------- +// tests that require no existing backups +// --------------------------------------------------------------------------- + +type NoBackupTeamsE2ESuite struct { + tester.Suite + dpnd dependencies + its intgTesterSetup +} + +func TestNoBackupTeamsE2ESuite(t *testing.T) { + t.Skip("enable when e2e is complete for teams") + + suite.Run(t, &BackupTeamsE2ESuite{Suite: tester.NewE2ESuite( + t, + [][]string{storeTD.AWSStorageCredEnvs, tconfig.M365AcctCredEnvs}, + )}) +} + +func (suite *NoBackupTeamsE2ESuite) SetupSuite() { + t := suite.T() + + ctx, flush := tester.NewContext(t) + defer flush() + + suite.its = newIntegrationTesterSetup(t) + suite.dpnd = prepM365Test(t, ctx) +} + +func (suite *NoBackupTeamsE2ESuite) TestTeamsBackupListCmd_noBackups() { + t := suite.T() + ctx, flush := tester.NewContext(t) + ctx = config.SetViper(ctx, suite.dpnd.vpr) + + defer flush() + + suite.dpnd.recorder.Reset() + + cmd := cliTD.StubRootCmd( + "backup", "list", "teams", + "--config-file", suite.dpnd.configFilePath) + cli.BuildCommandTree(cmd) + + cmd.SetErr(&suite.dpnd.recorder) + + ctx = print.SetRootCmd(ctx, cmd) + + // run the command + err := cmd.ExecuteContext(ctx) + require.NoError(t, err, clues.ToCore(err)) + + result := suite.dpnd.recorder.String() + + // as an offhand check: the result should contain the m365 team id + assert.True(t, strings.HasSuffix(result, "No backups available\n")) +} + // --------------------------------------------------------------------------- // tests with no prior backup // --------------------------------------------------------------------------- @@ -134,34 +191,6 @@ func runTeamsBackupTeamNotFoundTest(suite *BackupTeamsE2ESuite, category path.Ca t.Log("backup results", result) } -func (suite *BackupTeamsE2ESuite) TestTeamsBackupListCmd_empty() { - t := suite.T() - ctx, flush := tester.NewContext(t) - ctx = config.SetViper(ctx, suite.dpnd.vpr) - - defer flush() - - suite.dpnd.recorder.Reset() - - cmd := cliTD.StubRootCmd( - "backup", "list", "teams", - "--config-file", suite.dpnd.configFilePath) - cli.BuildCommandTree(cmd) - - cmd.SetErr(&suite.dpnd.recorder) - - ctx = print.SetRootCmd(ctx, cmd) - - // run the command - err := cmd.ExecuteContext(ctx) - require.NoError(t, err, clues.ToCore(err)) - - result := suite.dpnd.recorder.String() - - // as an offhand check: the result should contain the m365 team id - assert.True(t, strings.HasSuffix(result, "No backups available\n")) -} - func (suite *BackupTeamsE2ESuite) TestBackupCreateTeams_badAzureClientIDFlag() { t := suite.T() ctx, flush := tester.NewContext(t)