Skip to content

Commit

Permalink
Check if the downloaded and extracted files are correctly deleted aft…
Browse files Browse the repository at this point in the history
…er plugin is correctly installed
  • Loading branch information
mostafa committed Sep 28, 2023
1 parent 106df06 commit dcc9941
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions cmd/plugin_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
4 changes: 2 additions & 2 deletions cmd/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
}

0 comments on commit dcc9941

Please sign in to comment.