generated from nginxinc/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Better test coverage across most modules - improve RoundTripper coverage - exclude coverage files from source control - Test coverage for UpstreamServer - Test coverage for probation server module - Test coverage for Event module - ignore test coverage files * - address PR feedback
- Loading branch information
Showing
5 changed files
with
72 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ Thumbs.db | |
cover* | ||
tmp/ | ||
docs/tls/DESIGN.md | ||
:q | ||
qqq |
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,31 @@ | ||
package core | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
"testing" | ||
) | ||
|
||
func TestNewEvent(t *testing.T) { | ||
expectedType := Created | ||
expectedService := &v1.Service{} | ||
expectedPreviousService := &v1.Service{} | ||
expectedNodeIps := []string{"127.0.0.1"} | ||
|
||
event := NewEvent(expectedType, expectedService, expectedPreviousService, expectedNodeIps) | ||
|
||
if event.Type != expectedType { | ||
t.Errorf("expected Created, got %v", event.Type) | ||
} | ||
|
||
if event.Service != expectedService { | ||
t.Errorf("expected service, got %#v", event.Service) | ||
} | ||
|
||
if event.PreviousService != expectedPreviousService { | ||
t.Errorf("expected previous service, got %#v", event.PreviousService) | ||
} | ||
|
||
if event.NodeIps[0] != expectedNodeIps[0] { | ||
t.Errorf("expected node ips, got %#v", event.NodeIps) | ||
} | ||
} |
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,16 @@ | ||
/* | ||
* Copyright (c) 2023 F5 Inc. All rights reserved. | ||
* Use of this source code is governed by the Apache License that can be found in the LICENSE file. | ||
*/ | ||
|
||
package core | ||
|
||
import "testing" | ||
|
||
func TestNewUpstreamServer(t *testing.T) { | ||
host := "localhost" | ||
us := NewUpstreamServer(host) | ||
if us.Host != host { | ||
t.Errorf("NewUpstreamServer(%s) = %s; want %s", host, us.Host, host) | ||
} | ||
} |
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