mirror of
https://github.com/hyprspace/hyprspace.git
synced 2026-09-12 19:51:07 +05:00
test(dns): add T22-T23 - domainSuffix and withDomainSuffix tests
This commit is contained in:
parent
e6f9e9628a
commit
51eb0f6d74
43
dns/dns_response_test.go
Normal file
43
dns/dns_response_test.go
Normal file
@ -0,0 +1,43 @@
|
||||
package dns
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hyprspace/hyprspace/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestT22_domainSuffix_hyprspace(t *testing.T) {
|
||||
cfg := config.Config{Interface: "hyprspace"}
|
||||
assert.Equal(t, "hyprspace.", domainSuffix(cfg))
|
||||
}
|
||||
|
||||
func TestT22_domainSuffix_custom(t *testing.T) {
|
||||
cfg := config.Config{Interface: "hs0"}
|
||||
assert.Equal(t, "hs0.hyprspace.", domainSuffix(cfg))
|
||||
}
|
||||
|
||||
func TestT22_domainSuffix_other(t *testing.T) {
|
||||
cfg := config.Config{Interface: "myvpn"}
|
||||
assert.Equal(t, "myvpn.hyprspace.", domainSuffix(cfg))
|
||||
}
|
||||
|
||||
func TestT22_domainSuffix_empty(t *testing.T) {
|
||||
cfg := config.Config{Interface: ""}
|
||||
assert.Equal(t, ".hyprspace.", domainSuffix(cfg))
|
||||
}
|
||||
|
||||
func TestT23_withDomainSuffix(t *testing.T) {
|
||||
cfg := config.Config{Interface: "hyprspace"}
|
||||
assert.Equal(t, "alice.hyprspace.", withDomainSuffix(cfg, "alice"))
|
||||
}
|
||||
|
||||
func TestT23_withDomainSuffix_customInterface(t *testing.T) {
|
||||
cfg := config.Config{Interface: "hs0"}
|
||||
assert.Equal(t, "bob.hs0.hyprspace.", withDomainSuffix(cfg, "bob"))
|
||||
}
|
||||
|
||||
func TestT23_withDomainSuffix_servicePrefix(t *testing.T) {
|
||||
cfg := config.Config{Interface: "hs0"}
|
||||
assert.Equal(t, "http.alice.hs0.hyprspace.", withDomainSuffix(cfg, "http.alice"))
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user