@@ -15,8 +15,8 @@ import (
15
15
16
16
func Test_shouldDownload (t * testing.T ) {
17
17
type args struct {
18
- vuls2Cnf config.Vuls2DictConf
19
- now time.Time
18
+ vuls2Conf config.Vuls2Conf
19
+ now time.Time
20
20
}
21
21
tests := []struct {
22
22
name string
@@ -28,15 +28,15 @@ func Test_shouldDownload(t *testing.T) {
28
28
{
29
29
name : "no db file" ,
30
30
args : args {
31
- vuls2Cnf : config.Vuls2DictConf {},
32
- now : * parse ("2024-01-02T00:00:00Z" ),
31
+ vuls2Conf : config.Vuls2Conf {},
32
+ now : * parse ("2024-01-02T00:00:00Z" ),
33
33
},
34
34
want : true ,
35
35
},
36
36
{
37
37
name : "no db file, but skip update" ,
38
38
args : args {
39
- vuls2Cnf : config.Vuls2DictConf {
39
+ vuls2Conf : config.Vuls2Conf {
40
40
SkipUpdate : true ,
41
41
},
42
42
now : * parse ("2024-01-02T00:00:00Z" ),
@@ -46,8 +46,8 @@ func Test_shouldDownload(t *testing.T) {
46
46
{
47
47
name : "just created" ,
48
48
args : args {
49
- vuls2Cnf : config.Vuls2DictConf {},
50
- now : * parse ("2024-01-02T00:00:00Z" ),
49
+ vuls2Conf : config.Vuls2Conf {},
50
+ now : * parse ("2024-01-02T00:00:00Z" ),
51
51
},
52
52
metadata : & types.Metadata {
53
53
LastModified : * parse ("2024-01-02T00:00:00Z" ),
@@ -59,8 +59,8 @@ func Test_shouldDownload(t *testing.T) {
59
59
{
60
60
name : "8 hours old" ,
61
61
args : args {
62
- vuls2Cnf : config.Vuls2DictConf {},
63
- now : * parse ("2024-01-02T08:00:00Z" ),
62
+ vuls2Conf : config.Vuls2Conf {},
63
+ now : * parse ("2024-01-02T08:00:00Z" ),
64
64
},
65
65
metadata : & types.Metadata {
66
66
LastModified : * parse ("2024-01-02T00:00:00Z" ),
@@ -72,7 +72,7 @@ func Test_shouldDownload(t *testing.T) {
72
72
{
73
73
name : "8 hours old, but skip update" ,
74
74
args : args {
75
- vuls2Cnf : config.Vuls2DictConf {
75
+ vuls2Conf : config.Vuls2Conf {
76
76
SkipUpdate : true ,
77
77
},
78
78
now : * parse ("2024-01-02T08:00:00Z" ),
@@ -87,8 +87,8 @@ func Test_shouldDownload(t *testing.T) {
87
87
{
88
88
name : "8 hours old, but download recently" ,
89
89
args : args {
90
- vuls2Cnf : config.Vuls2DictConf {},
91
- now : * parse ("2024-01-02T08:00:00Z" ),
90
+ vuls2Conf : config.Vuls2Conf {},
91
+ now : * parse ("2024-01-02T08:00:00Z" ),
92
92
},
93
93
metadata : & types.Metadata {
94
94
LastModified : * parse ("2024-01-02T00:00:00Z" ),
@@ -101,14 +101,14 @@ func Test_shouldDownload(t *testing.T) {
101
101
for _ , tt := range tests {
102
102
t .Run (tt .name , func (t * testing.T ) {
103
103
d := t .TempDir ()
104
- tt .args .vuls2Cnf .Path = filepath .Join (d , "vuls.db" )
104
+ tt .args .vuls2Conf .Path = filepath .Join (d , "vuls.db" )
105
105
if tt .metadata != nil {
106
- if err := putMetadata (* tt .metadata , tt .args .vuls2Cnf .Path ); err != nil {
106
+ if err := putMetadata (* tt .metadata , tt .args .vuls2Conf .Path ); err != nil {
107
107
t .Errorf ("putMetadata err = %v" , err )
108
108
return
109
109
}
110
110
}
111
- got , err := shouldDownload (tt .args .vuls2Cnf , tt .args .now )
111
+ got , err := shouldDownload (tt .args .vuls2Conf , tt .args .now )
112
112
if (err != nil ) != tt .wantErr {
113
113
t .Errorf ("shouldDownload() error = %v, wantErr %v" , err , tt .wantErr )
114
114
return
0 commit comments