// TestGetMissingResources validates that resources that are found in a directory
// but not defined in a kustomization.yaml file are returned correctly
TestGetMissingResources validates that resources that are found in a directory
but not defined in a kustomization.yaml file are returned correctly
// TestGetMissingResources validates that resources that are found in a directory // but not defined in a kustomization . yaml file are returned correctly
func TestGetMissingResources(t *testing.T) {
	   /app
	   ├── kustomization.yaml
	   └── excluded.yaml
	fakeFileSystem := afero.NewMemMapFs()
	fakeFileSystem.Mkdir("app", 0755)
	afero.WriteFile(fakeFileSystem, "app/kustomization.yaml", []byte(""), 0644)
	afero.WriteFile(fakeFileSystem, "app/excluded.yaml", []byte(""), 0644)
	kustomizationFileContext := NewFromFileSystem(fakeFileSystem)
	kustomizationFile, err := kustomizationFileContext.GetFromDirectory("app")
	if err != nil {
		t.Fatalf("An error occured while getting kustomization file %v", err)
	}
	actual, err := kustomizationFileContext.GetMissingResources("app", kustomizationFile)
	if err != nil {
		t.Fatalf("An error occured while getting missing resources %v", err)
	}
	expected := []string{"excluded.yaml"}
	if reflect.DeepEqual(actual, expected) == false {
		t.Errorf("Returned wrong missing resources, got %s, want: %s", actual, expected)
	}
}
func TestGetMissingResources ( t * testing . T ) { fakeFileSystem := afero . NewMemMapFs ( ) fakeFileSystem . Mkdir ( " " , 0755 ) afero . WriteFile ( fakeFileSystem , " " , [ ] byte ( " " ) , 0644 ) afero . WriteFile ( fakeFileSystem , " " , [ ] byte ( " " ) , 0644 ) kustomizationFileContext := NewFromFileSystem ( fakeFileSystem ) kustomizationFile , err := kustomizationFileContext . GetFromDirectory ( " " ) if err != nil { t . Fatalf ( " " , err ) } actual , err := kustomizationFileContext . GetMissingResources ( " " , kustomizationFile ) if err != nil { t . Fatalf ( " " , err ) } expected := [ ] string { " " } if reflect . DeepEqual ( actual , expected ) == false { t . Errorf ( " " , actual , expected ) } }
TestGetMissingResources validates that resources that are found in a directory
but not defined in a kustomization.yaml file are returned correctly
TestGetMissingResources validates that resources that are found in a directory but not defined in a kustomization . yaml file are returned correctly
// Folder structure for this test // //   /app //   ├── kustomization.yaml //   └── excluded.yaml