mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
* Update the Devfile library * Add test for container-overrides and pod-overrides attributes Signed-off-by: Parthvi Vala <pvala@redhat.com> Attempt at fixing CI failures Signed-off-by: Parthvi Vala <pvala@redhat.com> * Fix CI failure * Attempt at fixing OC integration test failures Signed-off-by: Parthvi Vala <pvala@redhat.com> * Use random name in integration test Signed-off-by: Parthvi Vala <pvala@redhat.com> * Rebase and fix integration test failure Signed-off-by: Parthvi Vala <pvala@redhat.com> * Make integration test work for podman Signed-off-by: Parthvi Vala <pvala@redhat.com> * Temp attempt at fixing podman test for GH Signed-off-by: Parthvi Vala <pvala@redhat.com> * Another attempt at fixing CI test for podman Signed-off-by: Parthvi Vala <pvala@redhat.com> * One more attempt at fixing integration test for podman Signed-off-by: Parthvi Vala <pvala@redhat.com> Signed-off-by: Parthvi Vala <pvala@redhat.com>
44 lines
980 B
Go
44 lines
980 B
Go
package util
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/devfile/library/v2/pkg/testingutil/filesystem"
|
|
dfutil "github.com/devfile/library/v2/pkg/util"
|
|
)
|
|
|
|
func TestCleanDefaultHTTPCacheDir(t *testing.T) {
|
|
fakeFs := filesystem.NewFakeFs()
|
|
filesToGenerate := 10
|
|
for i := 0; i < filesToGenerate; i++ {
|
|
err := fakeFs.WriteFile(filepath.Join(httpCacheDir, dfutil.GenerateRandomString(10)), []byte(dfutil.GenerateRandomString(10)), os.ModePerm)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
files, err := fakeFs.ReadDir(httpCacheDir)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
// checking the file count before the run
|
|
if len(files) != filesToGenerate {
|
|
t.Error("the file count in the httpCacheDir don't match files generated")
|
|
}
|
|
err = cleanDefaultHTTPCacheDir(fakeFs)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
newFiles, err := fakeFs.ReadDir(httpCacheDir)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
if len(newFiles) != 0 {
|
|
t.Error("httpCacheDir is not empty after cleanup")
|
|
}
|
|
|
|
}
|