-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// This test requires VMX_HOME and VMX_SSH_CONFIG_HOME set to the test/config and test/ssh accordingly | ||
package config | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
"github.com/zshamrock/vmx/core" | ||
) | ||
|
||
func TestReadConfig(t *testing.T) { | ||
Init("") | ||
commands := GetCommands() | ||
expected := map[string]core.Command{ | ||
"logs": { | ||
Name: "logs", | ||
Command: "cat logs/app.log", | ||
WorkingDir: "/opt/app", | ||
}, | ||
"app-logs": { | ||
Name: "app-logs", | ||
Command: "tail -f -n 10 logs/app.log", | ||
WorkingDir: "/opt/app", | ||
}, | ||
"follow-logs": { | ||
Name: "follow-logs", | ||
Command: "tail -f -n 10 logs/app1.log", | ||
WorkingDir: "/opt/app1", | ||
Follow: true, | ||
}, | ||
"redeploy": { | ||
Name: "redeploy", | ||
Command: "./redeploy.sh", | ||
WorkingDir: "/opt/app", | ||
RequiresConfirmation: true, | ||
}, | ||
"disk-space": { | ||
Name: "disk-space", | ||
Command: "command=df -h", | ||
WorkingDir: "/opt/app", | ||
}, | ||
} | ||
equal := reflect.DeepEqual(commands, expected) | ||
if !equal { | ||
t.Errorf("Read commands %v from the 'commands' config file don't match expected commands %v", | ||
commands, expected) | ||
} | ||
} |