MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestSQLiteIPList_AddItem

Function TestSQLiteIPList_AddItem

internal/iplibrary/ip_list_sqlite_test.go:14–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestSQLiteIPList_AddItem(t *testing.T) {
15 db, err := iplibrary.NewSQLiteIPList()
16 if err != nil {
17 t.Fatal(err)
18 }
19 defer func() {
20 _ = db.Close()
21 }()
22
23 err = db.AddItem(&pb.IPItem{
24 Id: 1,
25 IpFrom: "192.168.1.101",
26 IpTo: "",
27 Version: 1024,
28 ExpiredAt: time.Now().Unix() + 3600,
29 Reason: "",
30 ListId: 2,
31 IsDeleted: false,
32 Type: "ipv4",
33 EventLevel: "error",
34 ListType: "black",
35 IsGlobal: true,
36 CreatedAt: 0,
37 NodeId: 11,
38 ServerId: 22,
39 SourceNodeId: 0,
40 SourceServerId: 0,
41 SourceHTTPFirewallPolicyId: 0,
42 SourceHTTPFirewallRuleGroupId: 0,
43 SourceHTTPFirewallRuleSetId: 0,
44 SourceServer: nil,
45 SourceHTTPFirewallPolicy: nil,
46 SourceHTTPFirewallRuleGroup: nil,
47 SourceHTTPFirewallRuleSet: nil,
48 })
49 if err != nil {
50 t.Fatal(err)
51 }
52
53 err = db.Close()
54 if err != nil {
55 t.Fatal(err)
56 }
57
58 t.Log("ok")
59}
60
61func TestSQLiteIPList_ReadItems(t *testing.T) {
62 db, err := iplibrary.NewSQLiteIPList()

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.95
AddItemMethod · 0.95
NewSQLiteIPListFunction · 0.92
UnixMethod · 0.80
LogMethod · 0.80

Tested by

no test coverage detected