kvm2: Create, Get, Delete and ListByTag with the contract tests
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -260,26 +260,3 @@ func TestWrapErr_carriesProviderNameOpAndID(t *testing.T) {
|
||||
t.Errorf("wrapErr() = %+v, want provider kvm2-home, op get, the id and ErrPermanent", pe)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStubs_returnPermanentWithProviderName(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
p := newProvider("kvm2-home", twoHosts(), &stubDialer{})
|
||||
_, createErr := p.Create(ctx, provider.CreateRequest{Name: "proxy-x"})
|
||||
inst, getErr := p.Get(ctx, "hosts/beelink/domains/proxy-x")
|
||||
deleteErr := p.Delete(ctx, "hosts/beelink/domains/proxy-x")
|
||||
list, listErr := p.ListByTag(ctx)
|
||||
if inst != nil || list != nil {
|
||||
t.Errorf("Get = %+v, ListByTag = %+v, want nil results from stubs", inst, list)
|
||||
}
|
||||
for op, err := range map[string]error{"create": createErr, "get": getErr, "delete": deleteErr, "list": listErr} {
|
||||
var pe *provider.Error
|
||||
if !errors.As(err, &pe) {
|
||||
t.Errorf("%s: error = %T, want *provider.Error", op, err)
|
||||
continue
|
||||
}
|
||||
if pe.Provider != "kvm2-home" || pe.Op != op || !errors.Is(err, provider.ErrPermanent) {
|
||||
t.Errorf("%s: error = %+v, want provider kvm2-home, op %s, ErrPermanent", op, pe, op)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user