MCPcopy
hub / github.com/apache/devlake / TestResolvePort

Function TestResolvePort

backend/core/utils/network_helper_test.go:39–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestResolvePort(t *testing.T) {
40 port, err := ResolvePort("80", "https")
41 if err != nil {
42 t.Error(err)
43 }
44 if port != "80" {
45 t.Errorf("Expected %s, Got %s", "80", port)
46 }
47 port, err = ResolvePort("", "http")
48 if err != nil {
49 t.Error(err)
50 }
51 if port != "80" {
52 t.Errorf("Expected %s, Got %s", "80", port)
53 }
54 _, err = ResolvePort("", "rabbitmq")
55 if err == nil {
56 t.Errorf("Expected error %s, Got nil", "schema not found")
57 }
58 _, err = ResolvePort("", "")
59 if err == nil {
60 t.Errorf("Expected error %s, Got nil", "you should provide at least one of port or schema")
61 }
62}

Callers

nothing calls this directly

Calls 2

ResolvePortFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected