Removed redundant test flag
This commit is contained in:
parent
e5f73fa256
commit
34da1bf202
|
@ -21,40 +21,34 @@ func TestHostnameFromURI(t *testing.T) {
|
||||||
|
|
||||||
func TestShouldRunQuickTunnel(t *testing.T) {
|
func TestShouldRunQuickTunnel(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
flags map[string]string
|
flags map[string]string
|
||||||
expectQuickTunnel bool
|
expectError bool
|
||||||
expectError bool
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Quick tunnel with URL set",
|
name: "Quick tunnel with URL set",
|
||||||
flags: map[string]string{"url": "http://127.0.0.1:8080", "quick-service": "https://fakeapi.trycloudflare.com"},
|
flags: map[string]string{"url": "http://127.0.0.1:8080", "quick-service": "https://fakeapi.trycloudflare.com"},
|
||||||
expectQuickTunnel: true,
|
expectError: false,
|
||||||
expectError: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Quick tunnel with unix-socket set",
|
name: "Quick tunnel with unix-socket set",
|
||||||
flags: map[string]string{"unix-socket": "/tmp/socket", "quick-service": "https://fakeapi.trycloudflare.com"},
|
flags: map[string]string{"unix-socket": "/tmp/socket", "quick-service": "https://fakeapi.trycloudflare.com"},
|
||||||
expectQuickTunnel: true,
|
expectError: false,
|
||||||
expectError: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Quick tunnel with hello-world flag",
|
name: "Quick tunnel with hello-world flag",
|
||||||
flags: map[string]string{"hello-world": "true", "quick-service": "https://fakeapi.trycloudflare.com"},
|
flags: map[string]string{"hello-world": "true", "quick-service": "https://fakeapi.trycloudflare.com"},
|
||||||
expectQuickTunnel: true,
|
expectError: false,
|
||||||
expectError: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Quick tunnel with proxy-dns (invalid combo)",
|
name: "Quick tunnel with proxy-dns (invalid combo)",
|
||||||
flags: map[string]string{"url": "http://127.0.0.1:9090", "proxy-dns": "true", "quick-service": "https://fakeapi.trycloudflare.com"},
|
flags: map[string]string{"url": "http://127.0.0.1:9090", "proxy-dns": "true", "quick-service": "https://fakeapi.trycloudflare.com"},
|
||||||
expectQuickTunnel: false,
|
expectError: true,
|
||||||
expectError: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "No quick-service set",
|
name: "No quick-service set",
|
||||||
flags: map[string]string{"url": "http://127.0.0.1:9090"},
|
flags: map[string]string{"url": "http://127.0.0.1:9090"},
|
||||||
expectQuickTunnel: false,
|
expectError: true,
|
||||||
expectError: true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +73,10 @@ func TestShouldRunQuickTunnel(t *testing.T) {
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if tt.expectError {
|
if tt.expectError {
|
||||||
|
assert.False(t, mockCalled)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
} else if tt.expectQuickTunnel {
|
|
||||||
assert.True(t, mockCalled)
|
|
||||||
require.NoError(t, err)
|
|
||||||
} else {
|
} else {
|
||||||
|
assert.True(t, mockCalled)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue