-
Notifications
You must be signed in to change notification settings - Fork 0
/
drivercore_test.go
49 lines (38 loc) · 1.05 KB
/
drivercore_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
package drivercore_test
import (
"testing"
"github.com/kuttiproject/drivercore"
"github.com/kuttiproject/drivercore/drivercoretest"
"github.com/kuttiproject/drivercore/drivercoretest/drivermock"
)
const TESTK8SVERSION = "1.22"
func init() {
mockdriver1 := drivermock.New("mock1", "Mock driver with NAT Networking", true, true)
drivercore.RegisterDriver("mock1", mockdriver1)
mockdriver1.UpdateRemoteImage(TESTK8SVERSION, false)
}
func TestDriverCore(t *testing.T) {
cnt := drivercore.DriverCount()
if cnt < 1 {
t.Fatal("no drivers found")
}
rd := drivercore.RegisteredDrivers()
if len(rd) < 1 {
t.Fatal("no drivers found")
}
drivercore.ForEachDriver(func(d drivercore.Driver) bool {
if d.Status() != "Ready" {
t.Fatalf("Driver status was %v instead of Ready", d.Status())
}
return true
})
ok := drivercore.IsRegisteredDriver("mock1")
if !ok {
t.Fatal("Driver mock1 not registered")
}
_, ok = drivercore.GetDriver("mock1")
if !ok {
t.Fatal("Driver mock1 not found")
}
drivercoretest.TestDriver(t, "mock1", TESTK8SVERSION)
}