FAIL: <autogenerated>:1: DaemonEtcdSuite.TestEndpointAddNoLabels
endpoint_test.go:150:
c.Errorf("Metrics assertion failed on line %d for Endpoint state %s: obtained %d, expected %d",
line, state, obtained, expected)
... Error: Metrics assertion failed on line 104 for Endpoint state waiting-to-regenerate: obtained 0, expected 1
// Create the endpoint without any labels.
epTemplate := getEPTemplate(c, ds.d)
_, _, err := ds.d.createEndpoint(context.TODO(), epTemplate)
c.Assert(err, IsNil)
// Endpoint enters WaitingToRegenerate as it has its labels updated during
// creation.
-> assertOnMetric(c, string(models.EndpointStateWaitingToRegenerate), 1)
@christarazi createEndpoint will regenerate the endpoint in the background so line 104 might fail depending on the machine load. I would suggest to add a function that waits until the metric with that particular value similar to:
|
// Wait until lock1 is gotten. |
|
c.Assert(testutils.WaitUntil(func() bool { |
|
select { |
|
case <-gotLock1: |
|
return true |
|
default: |
|
return false |
|
} |
|
}, 5*time.Second), IsNil) |
@christarazi createEndpoint will regenerate the endpoint in the background so line 104 might fail depending on the machine load. I would suggest to add a function that waits until the metric with that particular value similar to:
cilium/pkg/kvstore/allocator/allocator_test.go
Lines 174 to 182 in 3c9c970