mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-24 17:35:01 +01:00
40 lines
667 B
Go
40 lines
667 B
Go
|
package pruning
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestNewKeepNotReplicated(t *testing.T) {
|
||
|
|
||
|
inputs := map[string][]Snapshot{
|
||
|
"s1": []Snapshot{
|
||
|
stubSnap{name: "1", replicated: true},
|
||
|
stubSnap{name: "2", replicated: false},
|
||
|
stubSnap{name: "3", replicated: true},
|
||
|
},
|
||
|
"s2": []Snapshot{},
|
||
|
}
|
||
|
|
||
|
tcs := map[string]testCase{
|
||
|
"destroysOnlyReplicated": {
|
||
|
inputs: inputs["s1"],
|
||
|
rules: []KeepRule{
|
||
|
NewKeepNotReplicated(),
|
||
|
},
|
||
|
expDestroy: map[string]bool{
|
||
|
"1": true, "3": true,
|
||
|
},
|
||
|
},
|
||
|
"empty": {
|
||
|
inputs: inputs["s2"],
|
||
|
rules: []KeepRule{
|
||
|
NewKeepNotReplicated(),
|
||
|
},
|
||
|
expDestroy: map[string]bool{},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
testTable(tcs, t)
|
||
|
|
||
|
}
|