Add test for idempotent repo creation (#1037)
## Description Regression test to ensure that hidden --succeed-if-exists flag works. ## Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [x] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) * #913 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
67215c9bf1
commit
f8a6d33466
@ -79,6 +79,34 @@ func (suite *S3IntegrationSuite) TestInitS3Cmd() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *S3IntegrationSuite) TestInitMultipleTimes() {
|
||||||
|
ctx := tester.NewContext()
|
||||||
|
t := suite.T()
|
||||||
|
|
||||||
|
st := tester.NewPrefixedS3Storage(t)
|
||||||
|
cfg, err := st.S3Config()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
vpr, configFP, err := tester.MakeTempTestConfigClone(t, nil)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
ctx = config.SetViper(ctx, vpr)
|
||||||
|
|
||||||
|
for i := 0; i < 2; i++ {
|
||||||
|
cmd := tester.StubRootCmd(
|
||||||
|
"repo", "init", "s3",
|
||||||
|
"--config-file", configFP,
|
||||||
|
"--bucket", cfg.Bucket,
|
||||||
|
"--prefix", cfg.Prefix,
|
||||||
|
"--succeed-if-exists",
|
||||||
|
)
|
||||||
|
cli.BuildCommandTree(cmd)
|
||||||
|
|
||||||
|
// run the command
|
||||||
|
require.NoError(t, cmd.ExecuteContext(ctx))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (suite *S3IntegrationSuite) TestInitS3Cmd_missingBucket() {
|
func (suite *S3IntegrationSuite) TestInitS3Cmd_missingBucket() {
|
||||||
ctx := tester.NewContext()
|
ctx := tester.NewContext()
|
||||||
t := suite.T()
|
t := suite.T()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user