From 2c3edce891086d293686a50a12d042dc41922283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Ramon=20Ma=C3=B1es?= <32740567+jrmanes@users.noreply.github.com> Date: Thu, 23 May 2024 08:58:58 +0200 Subject: [PATCH] fix(volumes): more fixes (#363) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jose Ramon MaƱes --- README.md | 2 +- e2e/basic/basic_test.go | 2 +- e2e/basic/external_file_test.go | 3 ++- e2e/basic/file_test.go | 8 +++++++- e2e/basic/file_test_image_cached_test.go | 6 +++++- e2e/basic/folder_test.go | 2 +- e2e/basic/folder_test_image_cached_test.go | 6 +++++- e2e/basic/probe_test.go | 2 +- 8 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c5d73d9..12bad2e 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ Simple example: t.Fatalf("Error executing command '%v':", err) } - assert.Equal(t, wget, "Hello World!\n") + assert.Contains(t, wget, "Hello World!") } ``` diff --git a/e2e/basic/basic_test.go b/e2e/basic/basic_test.go index f5b5309..8c8ac26 100644 --- a/e2e/basic/basic_test.go +++ b/e2e/basic/basic_test.go @@ -49,5 +49,5 @@ func TestBasic(t *testing.T) { t.Fatalf("Error executing command '%v':", err) } - assert.Equal(t, wget, "Hello World!\n") + assert.Contains(t, wget, "Hello World!") } diff --git a/e2e/basic/external_file_test.go b/e2e/basic/external_file_test.go index 4e31671..feeb2e5 100644 --- a/e2e/basic/external_file_test.go +++ b/e2e/basic/external_file_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/celestiaorg/knuu/pkg/knuu" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -92,5 +93,5 @@ func TestExternalFile(t *testing.T) { t.Fatalf("Error executing command '%v':", err) } - assert.Equal(t, wget, "Hello World!\n") + assert.Contains(t, wget, "Hello World!") } diff --git a/e2e/basic/file_test.go b/e2e/basic/file_test.go index cb97477..e35f398 100644 --- a/e2e/basic/file_test.go +++ b/e2e/basic/file_test.go @@ -10,7 +10,9 @@ import ( "time" "github.com/celestiaorg/knuu/pkg/knuu" + "github.com/google/uuid" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -41,6 +43,10 @@ func TestFile(t *testing.T) { if err != nil { t.Fatalf("Error adding file '%v':", err) } + err = web.AddVolumeWithOwner("/usr/share/nginx/html", "1Gi", 0) + if err != nil { + t.Fatalf("Error adding volume: %v", err) + } err = web.Commit() if err != nil { t.Fatalf("Error committing instance: %v", err) @@ -71,7 +77,7 @@ func TestFile(t *testing.T) { t.Fatalf("Error executing command '%v':", err) } - assert.Equal(t, wget, "Hello World!\n") + assert.Contains(t, wget, "Hello World!") } func TestDownloadFileFromRunningInstance(t *testing.T) { diff --git a/e2e/basic/file_test_image_cached_test.go b/e2e/basic/file_test_image_cached_test.go index adb0dc7..5700a4c 100644 --- a/e2e/basic/file_test_image_cached_test.go +++ b/e2e/basic/file_test_image_cached_test.go @@ -37,6 +37,10 @@ func TestFileCached(t *testing.T) { if err != nil { t.Fatalf("Error executing command for '%v': %v", instanceName, err) } + err = instance.AddVolumeWithOwner("/usr/share/nginx/html", "1Gi", 0) + if err != nil { + t.Fatalf("Error adding volume: %v", err) + } err = instance.Commit() if err != nil { t.Fatalf("Error committing instance '%v': %v", instanceName, err) @@ -92,6 +96,6 @@ func TestFileCached(t *testing.T) { t.Fatalf("Error executing command: %v", err) } - assert.Equal(t, "Hello World!\n", wget) + assert.Contains(t, wget, "Hello World!") } } diff --git a/e2e/basic/folder_test.go b/e2e/basic/folder_test.go index 0f361ca..69c328e 100644 --- a/e2e/basic/folder_test.go +++ b/e2e/basic/folder_test.go @@ -64,5 +64,5 @@ func TestFolder(t *testing.T) { t.Fatalf("Error executing command '%v':", err) } - assert.Equal(t, wget, "Hello World!\n") + assert.Contains(t, wget, "Hello World!") } diff --git a/e2e/basic/folder_test_image_cached_test.go b/e2e/basic/folder_test_image_cached_test.go index ac2b67a..86fbaa4 100644 --- a/e2e/basic/folder_test_image_cached_test.go +++ b/e2e/basic/folder_test_image_cached_test.go @@ -38,6 +38,10 @@ func TestFolderCached(t *testing.T) { if err != nil { t.Fatalf("Error executing command for '%v': %v", instanceName, err) } + err = instance.AddVolumeWithOwner("/usr/share/nginx/html", "1Gi", 0) + if err != nil { + t.Fatalf("Error adding volume: %v", err) + } err = instance.Commit() if err != nil { t.Fatalf("Error committing instance '%v': %v", instanceName, err) @@ -93,6 +97,6 @@ func TestFolderCached(t *testing.T) { t.Fatalf("Error executing command: %v", err) } - assert.Equal(t, "Hello World!\n", wget) + assert.Contains(t, wget, "Hello World!") } } diff --git a/e2e/basic/probe_test.go b/e2e/basic/probe_test.go index ff7ed4d..8ddd493 100644 --- a/e2e/basic/probe_test.go +++ b/e2e/basic/probe_test.go @@ -79,5 +79,5 @@ func TestProbe(t *testing.T) { t.Fatalf("Error executing command '%v':", err) } - assert.Equal(t, wget, "Hello World!\n") + assert.Contains(t, wget, "Hello World!") }