Create DeleteWait and DeleteTimeout parameters for Destroy (#1177)

* Create DeleteWait and DeleteTimeout parameters

Signed-off-by: Virginia Tavares <briosovirginia@gmail.com>

* Create tests for deleteWait and deleteTimeout

Signed-off-by: Virginia Tavares <briosovirginia@gmail.com>

* build(deps): bump github.com/aws/aws-sdk-go from 1.48.6 to 1.48.7 (#1176)

Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.48.6 to 1.48.7.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.48.6...v1.48.7)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update temp_test.go with DeleteWait and DeleteTimeout

Signed-off-by: Virginia Tavares <briosovirginia@gmail.com>

* Create deleteWait function in state.go

Signed-off-by: Virginia Tavares <briosovirginia@gmail.com>

* Fix comments from review

Signed-off-by: Virginia Tavares <briosovirginia@gmail.com>

---------

Signed-off-by: Virginia Tavares <briosovirginia@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Virginia Tavares <virginia.tavares@ericsson.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Virgínia Tavares
2023-12-05 08:38:37 +08:00
committed by GitHub
co-authored by dependabot[bot] Virginia Tavares
parent 4659b2fdd8
commit b10692dc9b
12 changed files with 157 additions and 36 deletions
+10 -6
View File
@@ -474,9 +474,11 @@ func (a *App) Delete(c DeleteConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
if !c.SkipCharts() {
err := run.withPreparedCharts("delete", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Concurrency: c.Concurrency(),
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Concurrency: c.Concurrency(),
DeleteWait: c.DeleteWait(),
DeleteTimeout: c.DeleteTimeout(),
}, func() {
ok, errs = a.delete(run, c.Purge(), c)
})
@@ -495,9 +497,11 @@ func (a *App) Destroy(c DestroyConfigProvider) error {
return a.ForEachState(func(run *Run) (ok bool, errs []error) {
if !c.SkipCharts() {
err := run.withPreparedCharts("destroy", state.ChartPrepareOptions{
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Concurrency: c.Concurrency(),
SkipRepos: c.SkipDeps(),
SkipDeps: c.SkipDeps(),
Concurrency: c.Concurrency(),
DeleteWait: c.DeleteWait(),
DeleteTimeout: c.DeleteTimeout(),
}, func() {
ok, errs = a.delete(run, true, c)
})
+4
View File
@@ -159,6 +159,8 @@ type DeleteConfigProvider interface {
Purge() bool
SkipDeps() bool
SkipCharts() bool
DeleteWait() bool
DeleteTimeout() int
interactive
loggingConfig
@@ -171,6 +173,8 @@ type DestroyConfigProvider interface {
SkipDeps() bool
SkipCharts() bool
DeleteWait() bool
DeleteTimeout() int
interactive
loggingConfig
+17 -10
View File
@@ -15,16 +15,18 @@ import (
func TestDestroy_2(t *testing.T) {
type testcase struct {
ns string
concurrency int
error string
files map[string]string
selectors []string
lists map[exectest.ListKey]string
diffs map[exectest.DiffKey]error
upgraded []exectest.Release
deleted []exectest.Release
log string
ns string
concurrency int
error string
files map[string]string
selectors []string
lists map[exectest.ListKey]string
diffs map[exectest.DiffKey]error
upgraded []exectest.Release
deleted []exectest.Release
log string
deleteWait bool
deleteTimeout int
}
check := func(t *testing.T, tc testcase) {
@@ -77,6 +79,8 @@ func TestDestroy_2(t *testing.T) {
concurrency: tc.concurrency,
logger: logger,
includeTransitiveNeeds: false,
deleteWait: tc.deleteWait,
deleteTimeout: tc.deleteTimeout,
})
switch {
@@ -455,6 +459,9 @@ database 4 Fri Nov 1 08:40:07 2019 DEPLOYED mysql-3.1.0 3.1.0 def
anotherbackend 4 Fri Nov 1 08:40:07 2019 DEPLOYED anotherbackend-3.1.0 3.1.0 default
`,
},
// Enable wait and set timeout for destroy
deleteWait: true,
deleteTimeout: 300,
// Disable concurrency to avoid in-deterministic result
concurrency: 1,
upgraded: []exectest.Release{},
+30 -12
View File
@@ -41,6 +41,8 @@ type destroyConfig struct {
logger *zap.SugaredLogger
includeTransitiveNeeds bool
skipCharts bool
deleteWait bool
deleteTimeout int
}
func (d destroyConfig) Args() string {
@@ -75,18 +77,28 @@ func (d destroyConfig) IncludeTransitiveNeeds() bool {
return d.includeTransitiveNeeds
}
func (d destroyConfig) DeleteWait() bool {
return d.deleteWait
}
func (d destroyConfig) DeleteTimeout() int {
return d.deleteTimeout
}
func TestDestroy(t *testing.T) {
type testcase struct {
ns string
concurrency int
error string
files map[string]string
selectors []string
lists map[exectest.ListKey]string
diffs map[exectest.DiffKey]error
upgraded []exectest.Release
deleted []exectest.Release
log string
ns string
concurrency int
error string
files map[string]string
selectors []string
lists map[exectest.ListKey]string
diffs map[exectest.DiffKey]error
upgraded []exectest.Release
deleted []exectest.Release
log string
deleteWait bool
deleteTimeout int
}
check := func(t *testing.T, tc testcase) {
@@ -300,7 +312,10 @@ anotherbackend 4 Fri Nov 1 08:40:07 2019 DEPLOYED anotherbackend-3.1.0
},
// Disable concurrency to avoid in-deterministic result
concurrency: 1,
upgraded: []exectest.Release{},
// Enable wait and set timeout for destroy
deleteWait: true,
deleteTimeout: 300,
upgraded: []exectest.Release{},
deleted: []exectest.Release{
{Name: "frontend-v3", Flags: []string{}},
{Name: "frontend-v2", Flags: []string{}},
@@ -748,7 +763,10 @@ changing working directory back to "/path/to"
},
// Disable concurrency to avoid in-deterministic result
concurrency: 1,
upgraded: []exectest.Release{},
// Enable wait and set timeout for destroy
deleteWait: true,
deleteTimeout: 300,
upgraded: []exectest.Release{},
deleted: []exectest.Release{
{Name: "frontend-v1", Flags: []string{}},
},