Skip to content

Commit

Permalink
Add command test case to vpncscript
Browse files Browse the repository at this point in the history
Signed-off-by: hwipl <33433250+hwipl@users.noreply.github.com>
  • Loading branch information
hwipl committed May 17, 2024
1 parent 72c659d commit 7be9595
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/vpncscript/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ func TestRun(t *testing.T) {
t.Errorf("invalid token should return error")
}

// test connect with config creation error, invalid VPN PID
os.Clearenv()
t.Setenv("reason", "connect")
t.Setenv("VPNPID", "not a valid vpn pid!")
if err := run([]string{"test"}); err == nil {
t.Errorf("invalid config should return error")
}

// prepare environment with not existing sockfile
os.Clearenv()
sockfile := filepath.Join(t.TempDir(), "sockfile")
Expand Down

0 comments on commit 7be9595

Please sign in to comment.