From dcc9941960db2a4fff60b8734282ad480a0d913d Mon Sep 17 00:00:00 2001 From: Mostafa Moradian Date: Fri, 29 Sep 2023 00:34:35 +0200 Subject: [PATCH] Check if the downloaded and extracted files are correctly deleted after plugin is correctly installed --- cmd/plugin_install_test.go | 10 ++++++++-- cmd/run_test.go | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/plugin_install_test.go b/cmd/plugin_install_test.go index 0f931aa0..7e0c37f4 100644 --- a/cmd/plugin_install_test.go +++ b/cmd/plugin_install_test.go @@ -36,8 +36,14 @@ func Test_pluginInstallCmd(t *testing.T) { assert.Contains(t, output, "Name: gatewayd-plugin-cache") // Clean up. + assert.FileExists(t, "plugins/gatewayd-plugin-cache") + assert.NoFileExists(t, "gatewayd-plugin-cache-linux-amd64-v0.2.4.tar.gz") + assert.NoFileExists(t, "checksums.txt") + assert.NoFileExists(t, "plugins/LICENSE") + assert.NoFileExists(t, "plugins/README.md") + assert.NoFileExists(t, "plugins/checksum.txt") + assert.NoFileExists(t, "plugins/gatewayd_plugin.yaml") + assert.NoError(t, os.RemoveAll("plugins/")) - assert.NoError(t, os.Remove("checksums.txt")) - assert.NoError(t, os.Remove("gatewayd-plugin-cache-linux-amd64-v0.2.4.tar.gz")) assert.NoError(t, os.Remove(pluginTestConfigFile)) } diff --git a/cmd/run_test.go b/cmd/run_test.go index 0ff5f5cc..0969e6e8 100644 --- a/cmd/run_test.go +++ b/cmd/run_test.go @@ -72,6 +72,8 @@ func Test_runCmd(t *testing.T) { assert.NoError(t, os.Remove(globalTestConfigFile)) } +// Test_runCmdWithMultiTenancy tests the run command with multi-tenancy enabled. +// Note: This test needs two instances of PostgreSQL running on ports 5432 and 5433. func Test_runCmdWithMultiTenancy(t *testing.T) { // Create a test plugins config file. _, err := executeCommandC(rootCmd, "plugin", "init", "--force", "-p", pluginTestConfigFile) @@ -206,8 +208,6 @@ func Test_runCmdWithCachePlugin(t *testing.T) { // Clean up. assert.NoError(t, os.RemoveAll("plugins/")) - assert.NoError(t, os.Remove("checksums.txt")) - assert.NoError(t, os.Remove("gatewayd-plugin-cache-linux-amd64-v0.2.4.tar.gz")) assert.NoError(t, os.Remove(pluginTestConfigFile)) assert.NoError(t, os.Remove(globalTestConfigFile)) }