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
@@ -189,3 +189,34 @@ func mustParse(t *testing.T, s string) time.Time {
|
||||
}
|
||||
return tm
|
||||
}
|
||||
|
||||
type diagnosticDetachCloud struct {
|
||||
*openstack.MockClient
|
||||
}
|
||||
|
||||
func (c diagnosticDetachCloud) GetFloatingIPByAddress(context.Context, string) (*openstack.FloatingIP, error) {
|
||||
return nil, errors.New("slow address search unavailable")
|
||||
}
|
||||
|
||||
func TestDiagnosticDetachUsesStoredFloatingIPID(t *testing.T) {
|
||||
o, d, ctx, mock := diagSetup(t)
|
||||
if err := d.ClaimDiagnostic(ctx, "validator-1", "1.1.1.1", "fip-a", "trace"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := mock.AssociateFloatingIP(ctx, "fip-a", "port-1"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
o.OS = diagnosticDetachCloud{MockClient: mock}
|
||||
|
||||
results := o.DiagnosticDetach(ctx, []string{"1.1.1.1"}, false)
|
||||
if len(results) != 1 || results[0].Status != DiagDetached || results[0].FIPID != "fip-a" {
|
||||
t.Fatalf("detach: %+v", results)
|
||||
}
|
||||
fip, err := mock.GetFloatingIP(ctx, "fip-a")
|
||||
if err != nil || fip.PortID != "" {
|
||||
t.Fatalf("floating IP: %+v, %v", fip, err)
|
||||
}
|
||||
if state := validatorState(t, d, "validator-1"); state != db.ValidatorIdle {
|
||||
t.Fatalf("validator: %s", state)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user