Files
velero/pkg/util/stringslice/stringslice_test.go
Andy Goldstein d24fb232cc Allow forced backup deletion
Add --force and --confirm to `ark backup delete` to support forced
backup deletion. This forcibly removes the Ark GC finalizer (if it's
present) from a backup and will orphan any resources associated with the
backup, such as backup tarballs in object storage, persistent volume
snapshots, and restores for the backup.

If a backup has a deletion timestamp, display `Deleting` in `ark backup
describe` and `ark backup get`.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-02-26 16:25:22 -05:00

47 lines
1.3 KiB
Go

/*
Copyright 2018 the Heptio Ark contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package stringslice
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestHas(t *testing.T) {
items := []string{}
assert.False(t, Has(items, "a"))
items = []string{"a", "b", "c"}
assert.True(t, Has(items, "a"))
assert.True(t, Has(items, "b"))
assert.True(t, Has(items, "c"))
assert.False(t, Has(items, "d"))
}
func TestExcept(t *testing.T) {
items := []string{}
except := Except(items, "asdf")
assert.Len(t, except, 0)
items = []string{"a", "b", "c"}
assert.Equal(t, []string{"b", "c"}, Except(items, "a"))
assert.Equal(t, []string{"a", "c"}, Except(items, "b"))
assert.Equal(t, []string{"a", "b"}, Except(items, "c"))
assert.Equal(t, []string{"a", "b", "c"}, Except(items, "d"))
}