Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/vpncscript test updates #91

Merged
merged 2 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion internal/vpncscript/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func setEnviron(env []string) {
for _, e := range env {
pair := strings.SplitN(e, "=", 2)
os.Setenv(pair[0], pair[1])
_ = os.Setenv(pair[0], pair[1])
}
}

Expand Down
Loading