-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5177 from annasong20/test-accumulate-remote-file
Test accumulateResources errors for remote files
- Loading branch information
Showing
4 changed files
with
153 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2023 The Kubernetes Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package kusttest_test | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"sigs.k8s.io/kustomize/kyaml/filesys" | ||
) | ||
|
||
// CreateKustDir creates a file system on disk and a new directory | ||
// that holds a kustomization file with content. The directory is removed on | ||
// test completion. | ||
func CreateKustDir(t *testing.T, content string) (filesys.FileSystem, filesys.ConfirmedDir) { | ||
t.Helper() | ||
|
||
fSys := filesys.MakeFsOnDisk() | ||
tmpDir, err := filesys.NewTmpConfirmedDir() | ||
require.NoError(t, err) | ||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(content))) | ||
|
||
t.Cleanup(func() { | ||
require.NoError(t, fSys.RemoveAll(tmpDir.String())) | ||
}) | ||
return fSys, tmpDir | ||
} |