Persist Floating IP UUIDs for direct Neutron operations
This commit is contained in:
1 parent
89ac4d5bcd
commit
94124747ce
24 files changed
+918
-116
No files matched your search
@@ -42,16 +42,22 @@ func TestDiagnosticOperationPartialSuccess(t *testing.T) {
|
||||
|
||||
type diagnosticLostResponse struct {
|
||||
*openstack.MockClient
|
||||
lookups int
|
||||
addressReads int
|
||||
uuidReads int
|
||||
associations int
|
||||
}
|
||||
|
||||
func (c *diagnosticLostResponse) GetFloatingIPByAddress(ctx context.Context, addr string) (*openstack.FloatingIP, error) {
|
||||
c.lookups++
|
||||
if c.lookups == 2 {
|
||||
c.addressReads++
|
||||
return c.MockClient.GetFloatingIPByAddress(ctx, addr)
|
||||
}
|
||||
|
||||
func (c *diagnosticLostResponse) GetFloatingIP(ctx context.Context, id string) (*openstack.FloatingIP, error) {
|
||||
c.uuidReads++
|
||||
if c.uuidReads == 1 {
|
||||
return nil, errors.New("Neutron temporarily unreachable")
|
||||
}
|
||||
return c.MockClient.GetFloatingIPByAddress(ctx, addr)
|
||||
return c.MockClient.GetFloatingIP(ctx, id)
|
||||
}
|
||||
|
||||
func (c *diagnosticLostResponse) AssociateFloatingIP(ctx context.Context, fipID, portID string) error {
|
||||
@@ -103,8 +109,10 @@ func TestDiagnosticOperationRecoversAppliedReservationAfterRestart(t *testing.T)
|
||||
t.Fatal(err)
|
||||
}
|
||||
op, err = d.GetDiagnosticOperation(ctx, id)
|
||||
if err != nil || len(op.Items) != 1 || op.Items[0].Status != DiagAttached || cloud.associations != 1 {
|
||||
t.Fatalf("operation was %+v, PUT count=%d, err=%v", op, cloud.associations, err)
|
||||
if err != nil || len(op.Items) != 1 || op.Items[0].Status != DiagAttached ||
|
||||
cloud.associations != 1 || cloud.addressReads != 1 || cloud.uuidReads != 2 {
|
||||
t.Fatalf("operation was %+v, PUT count=%d, address reads=%d, UUID reads=%d, err=%v",
|
||||
op, cloud.associations, cloud.addressReads, cloud.uuidReads, err)
|
||||
}
|
||||
events, err := d.ListRecentEvents(ctx, 10)
|
||||
if err != nil || len(events) != 1 || events[0].EventType != "diagnostic_attached" {
|
||||
|
||||
Reference in new issue
Block a user