mirror of https://github.com/fluxcd/cli-utils.git
fix lint errors
This commit is contained in:
parent
452b74480e
commit
675fa4b45b
|
|
@ -281,7 +281,7 @@ func TestApplyWithPresenceAnnotation(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Equal(t, false, exist)
|
||||
|
||||
r, err = a.Do()
|
||||
_, err = a.Do()
|
||||
assert.NoError(t, err)
|
||||
exist, err = util.ObjectExist(a.DynamicClient, context.Background(), liveService)
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@ import (
|
|||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
func jsonPath(fields []string) string {
|
||||
return "." + strings.Join(fields, ".")
|
||||
}
|
||||
|
||||
// ObjWithConditions Represent meta object with status.condition array
|
||||
type ObjWithConditions struct {
|
||||
// Status as expected to be present in most compliant kubernetes resources
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import (
|
|||
helperu "sigs.k8s.io/cli-experimental/internal/pkg/client/unstructured"
|
||||
)
|
||||
|
||||
var emptyObj = map[string]interface{}{}
|
||||
var testObj = map[string]interface{}{
|
||||
"f1": map[string]interface{}{
|
||||
"f2": map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -519,6 +519,7 @@ func TestDeleteWithPresenceNoInventory(t *testing.T) {
|
|||
// Then run delete
|
||||
// Confirm that the service is deleted
|
||||
_, err = d.Do()
|
||||
assert.NoError(t, err)
|
||||
exist, err = util.ObjectExist(a.DynamicClient, context.Background(), liveService)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, false, exist)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package resourceconfig
|
|||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sigs.k8s.io/kustomize/k8sdeps/validator"
|
||||
|
|
@ -68,7 +69,11 @@ func (p *KustomizeProvider) getKustTarget(path string) (ifc.Loader, *target.Kust
|
|||
// IsSupported checks if the path is supported by KustomizeProvider
|
||||
func (p *KustomizeProvider) IsSupported(path string) bool {
|
||||
ldr, _, err := p.getKustTarget(path)
|
||||
defer ldr.Cleanup()
|
||||
defer func() {
|
||||
if err := ldr.Cleanup(); err != nil {
|
||||
log.Fatal("failed to clean up the loader")
|
||||
}
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
|
|
@ -82,7 +87,12 @@ func (p *KustomizeProvider) GetConfig(path string) ([]*unstructured.Unstructured
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer ldr.Cleanup()
|
||||
defer func() {
|
||||
if err := ldr.Cleanup(); err != nil {
|
||||
log.Fatal("failed to clean up the loader")
|
||||
}
|
||||
}()
|
||||
|
||||
rm, err := kt.MakeCustomizedResMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ func TestKustomizeProvider2(t *testing.T) {
|
|||
assert.NotEmpty(t, pobject)
|
||||
assert.NotNil(t, pobject)
|
||||
inv := inventory.NewInventory()
|
||||
inv.LoadFromAnnotation(pobject[1].GetAnnotations())
|
||||
err = inv.LoadFromAnnotation(pobject[1].GetAnnotations())
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, len(inv.Current), 1)
|
||||
}
|
||||
|
||||
|
|
@ -189,6 +190,8 @@ func TestRawConfigFileProvider(t *testing.T) {
|
|||
assert.Equal(t, expected[0], resources[0])
|
||||
|
||||
b = cp.IsSupported(subdir)
|
||||
assert.Equal(t, b, true)
|
||||
assert.Equal(t, b, true)
|
||||
resources, err = cp.GetConfig(subdir)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, len(resources), 2)
|
||||
|
|
|
|||
Loading…
Reference in New Issue