mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Deployment: Fix data race in unit tests.
This commit is contained in:
parent
f020c9ae6c
commit
111b9ce9b5
@ -635,8 +635,9 @@ func TestUpdateReplicaSet(t *testing.T) {
|
|||||||
dc, _ := f.newController()
|
dc, _ := f.newController()
|
||||||
|
|
||||||
prev := *rs1
|
prev := *rs1
|
||||||
bumpResourceVersion(rs1)
|
next := *rs1
|
||||||
dc.updateReplicaSet(&prev, rs1)
|
bumpResourceVersion(&next)
|
||||||
|
dc.updateReplicaSet(&prev, &next)
|
||||||
if got, want := dc.queue.Len(), 1; got != want {
|
if got, want := dc.queue.Len(), 1; got != want {
|
||||||
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
||||||
}
|
}
|
||||||
@ -650,8 +651,9 @@ func TestUpdateReplicaSet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prev = *rs2
|
prev = *rs2
|
||||||
bumpResourceVersion(rs2)
|
next = *rs2
|
||||||
dc.updateReplicaSet(&prev, rs2)
|
bumpResourceVersion(&next)
|
||||||
|
dc.updateReplicaSet(&prev, &next)
|
||||||
if got, want := dc.queue.Len(), 1; got != want {
|
if got, want := dc.queue.Len(), 1; got != want {
|
||||||
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
||||||
}
|
}
|
||||||
@ -686,8 +688,9 @@ func TestUpdateReplicaSetOrphanWithNewLabels(t *testing.T) {
|
|||||||
// Change labels and expect all matching controllers to queue.
|
// Change labels and expect all matching controllers to queue.
|
||||||
prev := *rs
|
prev := *rs
|
||||||
prev.Labels = map[string]string{"foo": "notbar"}
|
prev.Labels = map[string]string{"foo": "notbar"}
|
||||||
bumpResourceVersion(rs)
|
next := *rs
|
||||||
dc.updateReplicaSet(&prev, rs)
|
bumpResourceVersion(&next)
|
||||||
|
dc.updateReplicaSet(&prev, &next)
|
||||||
if got, want := dc.queue.Len(), 2; got != want {
|
if got, want := dc.queue.Len(), 2; got != want {
|
||||||
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
||||||
}
|
}
|
||||||
@ -712,8 +715,9 @@ func TestUpdateReplicaSetChangeControllerRef(t *testing.T) {
|
|||||||
// Change ControllerRef and expect both old and new to queue.
|
// Change ControllerRef and expect both old and new to queue.
|
||||||
prev := *rs
|
prev := *rs
|
||||||
prev.OwnerReferences = []metav1.OwnerReference{*newControllerRef(d2)}
|
prev.OwnerReferences = []metav1.OwnerReference{*newControllerRef(d2)}
|
||||||
bumpResourceVersion(rs)
|
next := *rs
|
||||||
dc.updateReplicaSet(&prev, rs)
|
bumpResourceVersion(&next)
|
||||||
|
dc.updateReplicaSet(&prev, &next)
|
||||||
if got, want := dc.queue.Len(), 2; got != want {
|
if got, want := dc.queue.Len(), 2; got != want {
|
||||||
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
||||||
}
|
}
|
||||||
@ -737,9 +741,10 @@ func TestUpdateReplicaSetRelease(t *testing.T) {
|
|||||||
|
|
||||||
// Remove ControllerRef and expect all matching controller to sync orphan.
|
// Remove ControllerRef and expect all matching controller to sync orphan.
|
||||||
prev := *rs
|
prev := *rs
|
||||||
rs.OwnerReferences = nil
|
next := *rs
|
||||||
bumpResourceVersion(rs)
|
next.OwnerReferences = nil
|
||||||
dc.updateReplicaSet(&prev, rs)
|
bumpResourceVersion(&next)
|
||||||
|
dc.updateReplicaSet(&prev, &next)
|
||||||
if got, want := dc.queue.Len(), 2; got != want {
|
if got, want := dc.queue.Len(), 2; got != want {
|
||||||
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user