github.com/verrazzano/verrazzano@v1.7.0/tools/psr/psrctl/pkg/manifest/manifest_test.go (about) 1 // Copyright (c) 2022, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 package manifest 5 6 import ( 7 "os" 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 ) 12 13 // TestEmbeddedManifests tests the createPsrTempDir and newPsrManifests functions 14 // GIVEN a binary with the embedded manifests 15 // 16 // WHEN the PsrManifest is created 17 // THEN ensure that the resulting directories exist 18 func TestEmbeddedManifests(t *testing.T) { 19 tmpDir, err := createPsrTempDir() 20 assert.NoError(t, err) 21 defer os.RemoveAll(tmpDir) 22 assertDirExists(t, tmpDir) 23 24 man, err := newPsrManifests(tmpDir) 25 assert.NoError(t, err) 26 defer os.RemoveAll(tmpDir) 27 assertDirExists(t, man.ScenarioAbsDir) 28 assertDirExists(t, man.UseCasesAbsDir) 29 assertDirExists(t, man.WorkerChartAbsDir) 30 } 31 32 func assertDirExists(t *testing.T, dir string) { 33 _, err := os.Stat(dir) 34 assert.NoError(t, err) 35 }