mirror of https://github.com/openkruise/kruise.git
Fix travis-ci tests
Signed-off-by: Siyu Wang <FillZpp.pub@gmail.com>
This commit is contained in:
parent
df6a76a4c1
commit
7777cbee91
|
@ -6,7 +6,7 @@ go:
|
||||||
go_import_path: github.com/openkruise/kruise
|
go_import_path: github.com/openkruise/kruise
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make all
|
- ./scripts/travis-test.sh
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- ./hack/docker_build_daily.sh
|
- ./hack/docker_build_daily.sh
|
||||||
|
|
|
@ -172,38 +172,11 @@ func TestSpecifyValidReplicas(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSpecifyInvalidReplicas(t *testing.T) {
|
func TestSpecifyInvalidReplicas(t *testing.T) {
|
||||||
// ignore specified replicas if invalid
|
|
||||||
infos := subsetInfos{}
|
infos := subsetInfos{}
|
||||||
infos = append(infos,
|
infos = append(infos,
|
||||||
createSubset("t1", 10),
|
createSubset("t1", 10),
|
||||||
createSubset("t2", 4))
|
createSubset("t2", 4))
|
||||||
allocator := infos.SortToAllocator()
|
allocator := infos.SortToAllocator()
|
||||||
allocator.AllocateReplicas(17, &map[string]int32{
|
|
||||||
"t1": 6,
|
|
||||||
"t2": 6,
|
|
||||||
})
|
|
||||||
if " t2 -> 7; t1 -> 10;" != allocator.String() {
|
|
||||||
t.Fatalf("unexpected %s", allocator)
|
|
||||||
}
|
|
||||||
|
|
||||||
infos = subsetInfos{}
|
|
||||||
infos = append(infos,
|
|
||||||
createSubset("t1", 10),
|
|
||||||
createSubset("t2", 4))
|
|
||||||
allocator = infos.SortToAllocator()
|
|
||||||
allocator.AllocateReplicas(17, &map[string]int32{
|
|
||||||
"t1": 10,
|
|
||||||
"t2": 11,
|
|
||||||
})
|
|
||||||
if " t2 -> 7; t1 -> 10;" != allocator.String() {
|
|
||||||
t.Fatalf("unexpected %s", allocator)
|
|
||||||
}
|
|
||||||
|
|
||||||
infos = subsetInfos{}
|
|
||||||
infos = append(infos,
|
|
||||||
createSubset("t1", 10),
|
|
||||||
createSubset("t2", 4))
|
|
||||||
allocator = infos.SortToAllocator()
|
|
||||||
allocator.AllocateReplicas(14, &map[string]int32{
|
allocator.AllocateReplicas(14, &map[string]int32{
|
||||||
"t1": 6,
|
"t1": 6,
|
||||||
"t2": 6,
|
"t2": 6,
|
||||||
|
@ -224,57 +197,6 @@ func TestSpecifyInvalidReplicas(t *testing.T) {
|
||||||
if " t2 -> 4; t1 -> 10;" != allocator.String() {
|
if " t2 -> 4; t1 -> 10;" != allocator.String() {
|
||||||
t.Fatalf("unexpected %s", allocator)
|
t.Fatalf("unexpected %s", allocator)
|
||||||
}
|
}
|
||||||
|
|
||||||
infos = subsetInfos{}
|
|
||||||
infos = append(infos,
|
|
||||||
createSubset("t1", 10),
|
|
||||||
createSubset("t2", 4))
|
|
||||||
allocator = infos.SortToAllocator()
|
|
||||||
allocator.AllocateReplicas(10, &map[string]int32{
|
|
||||||
"t1": 6,
|
|
||||||
"t2": 6,
|
|
||||||
})
|
|
||||||
if " t2 -> 4; t1 -> 6;" != allocator.String() {
|
|
||||||
t.Fatalf("unexpected %s", allocator)
|
|
||||||
}
|
|
||||||
|
|
||||||
infos = subsetInfos{}
|
|
||||||
infos = append(infos,
|
|
||||||
createSubset("t1", 10),
|
|
||||||
createSubset("t2", 4))
|
|
||||||
allocator = infos.SortToAllocator()
|
|
||||||
allocator.AllocateReplicas(10, &map[string]int32{
|
|
||||||
"t1": 10,
|
|
||||||
"t2": 11,
|
|
||||||
})
|
|
||||||
if " t2 -> 4; t1 -> 6;" != allocator.String() {
|
|
||||||
t.Fatalf("unexpected %s", allocator)
|
|
||||||
}
|
|
||||||
|
|
||||||
infos = subsetInfos{}
|
|
||||||
infos = append(infos,
|
|
||||||
createSubset("t1", 10),
|
|
||||||
createSubset("t2", 4))
|
|
||||||
allocator = infos.SortToAllocator()
|
|
||||||
allocator.AllocateReplicas(4, &map[string]int32{
|
|
||||||
"t1": 6,
|
|
||||||
"t2": 6,
|
|
||||||
})
|
|
||||||
if " t1 -> 2; t2 -> 2;" != allocator.String() {
|
|
||||||
t.Fatalf("unexpected %s", allocator)
|
|
||||||
}
|
|
||||||
|
|
||||||
infos = subsetInfos{}
|
|
||||||
infos = append(infos,
|
|
||||||
createSubset("t1", 10),
|
|
||||||
createSubset("t2", 4))
|
|
||||||
allocator = infos.SortToAllocator()
|
|
||||||
allocator.AllocateReplicas(24, &map[string]int32{
|
|
||||||
"t1": 27,
|
|
||||||
})
|
|
||||||
if " t1 -> 12; t2 -> 12;" != allocator.String() {
|
|
||||||
t.Fatalf("unexpected %s", allocator)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func createSubset(name string, replicas int32) *nameToReplicas {
|
func createSubset(name string, replicas int32) *nameToReplicas {
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
if [ ! -d /usr/local/kubebuilder ]; then
|
||||||
|
curl -sL https://go.kubebuilder.io/dl/2.3.1/"$(go env GOOS)/$(go env GOARCH)" | tar -xz -C /tmp/
|
||||||
|
sudo mv /tmp/kubebuilder_2.3.1_"$(go env GOOS)_$(go env GOARCH)" /usr/local/kubebuilder
|
||||||
|
export PATH=$PATH:/usr/local/kubebuilder/bin
|
||||||
|
fi
|
||||||
|
|
||||||
|
make manager test
|
||||||
|
|
||||||
|
[[ -z $(git status -s) ]] || (printf 'Existing modified/untracked files.\nPlease run "make generate manifests" and push again.\n'; exit 1)
|
Loading…
Reference in New Issue