-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(component): always check for vpn errors
(cherry picked from commit 542d29e) - Remove basic authentication requirement by the read operations test
- Loading branch information
1 parent
0e39cfb
commit d1a1ac2
Showing
3 changed files
with
147 additions
and
52 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
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,29 @@ | ||
package component | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"net/url" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_wrapFirewallError(t *testing.T) { | ||
t.Run("dns error", func(t *testing.T) { | ||
someErr := &url.Error{ | ||
Err: &net.DNSError{ | ||
Err: "some message", | ||
}, | ||
} | ||
err := wrapVPNError(someErr) | ||
_, ok := err.(*vpnError) | ||
require.True(t, ok) | ||
}) | ||
t.Run("any other error", func(t *testing.T) { | ||
someErr := fmt.Errorf("lemon") | ||
err := wrapVPNError(someErr) | ||
_, ok := err.(*vpnError) | ||
require.False(t, ok) | ||
}) | ||
} |
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