-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathnetperf_test.go
61 lines (53 loc) · 1.6 KB
/
netperf_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package netperf
import (
"testing"
"github.com/cloud-bulldozer/k8s-netperf/pkg/config"
)
// TestParseConf Test for success. Ensure we successfully parse a good config file
func TestParseConf(t *testing.T) {
file := "test-config.yml"
_, err := config.ParseConf(file)
if err != nil {
t.Fatal("Parsing config file failed")
}
}
// TestParseConf Test for success. Ensure we successfully parse a good config file
func TestParseV2Conf(t *testing.T) {
file := "test-v2config.yml"
_, err := config.ParseV2Conf(file)
if err != nil {
t.Fatal("Parsing config file failed")
}
}
// TestParseConf Test for success. Ensure we successfully parse the default config
func TestShippingConf(t *testing.T) {
file := "../netperf.yml"
_, err := config.ParseV2Conf(file)
if err != nil {
t.Fatal("Parsing config file failed")
}
}
// TestMissingParseConf Testing for failure. Test profile regex
func TestMissingParseConf(t *testing.T) {
file := "test-bad-missing-config.yml"
_, err := config.ParseConf(file)
if err == nil {
t.Fatal("Parsing config file should have failed but succeeded")
}
}
// TestMissingParseV2Conf Testing for failure. Test profile regex
func TestMissingParseV2Conf(t *testing.T) {
file := "test-bad-missing-v2config.yml"
_, err := config.ParseV2Conf(file)
if err == nil {
t.Fatal("Parsing config file should have failed but succeeded")
}
}
// TestBadParseConf Test for failure. User leaves out a config field
func TestBadParseConf(t *testing.T) {
file := "test-bad-profile-config.yml"
_, err := config.ParseConf(file)
if err == nil {
t.Fatal("Parsing config file should have failed but succeeded")
}
}