5
5
"errors"
6
6
"net/http"
7
7
"testing"
8
+ "time"
8
9
9
10
"github.com/docker/docker/api/types/container"
10
11
"github.com/h2non/gock"
@@ -48,7 +49,7 @@ func TestGenLocalCommand(t *testing.T) {
48
49
conn := pgtest .NewConn ()
49
50
defer conn .Close (t )
50
51
// Run test
51
- assert .NoError (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {}, true , "" , fsys , conn .Intercept ))
52
+ assert .NoError (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {}, true , "" , time . Second , fsys , conn .Intercept ))
52
53
// Validate api
53
54
assert .Empty (t , apitest .ListUnmatchedRequests ())
54
55
})
@@ -63,7 +64,7 @@ func TestGenLocalCommand(t *testing.T) {
63
64
Get ("/v" + utils .Docker .ClientVersion () + "/containers/" + utils .DbId ).
64
65
Reply (http .StatusServiceUnavailable )
65
66
// Run test
66
- assert .Error (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {}, true , "" , fsys ))
67
+ assert .Error (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {}, true , "" , time . Second , fsys ))
67
68
// Validate api
68
69
assert .Empty (t , apitest .ListUnmatchedRequests ())
69
70
})
@@ -83,7 +84,7 @@ func TestGenLocalCommand(t *testing.T) {
83
84
Get ("/v" + utils .Docker .ClientVersion () + "/images" ).
84
85
Reply (http .StatusServiceUnavailable )
85
86
// Run test
86
- assert .Error (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {}, true , "" , fsys ))
87
+ assert .Error (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {}, true , "" , time . Second , fsys ))
87
88
// Validate api
88
89
assert .Empty (t , apitest .ListUnmatchedRequests ())
89
90
})
@@ -106,7 +107,7 @@ func TestGenLocalCommand(t *testing.T) {
106
107
conn := pgtest .NewConn ()
107
108
defer conn .Close (t )
108
109
// Run test
109
- assert .NoError (t , Run (context .Background (), "" , dbConfig , LangSwift , []string {}, true , SwiftInternalAccessControl , fsys , conn .Intercept ))
110
+ assert .NoError (t , Run (context .Background (), "" , dbConfig , LangSwift , []string {}, true , SwiftInternalAccessControl , time . Second , fsys , conn .Intercept ))
110
111
// Validate api
111
112
assert .Empty (t , apitest .ListUnmatchedRequests ())
112
113
})
@@ -129,7 +130,7 @@ func TestGenLinkedCommand(t *testing.T) {
129
130
Reply (200 ).
130
131
JSON (api.TypescriptResponse {Types : "" })
131
132
// Run test
132
- assert .NoError (t , Run (context .Background (), projectId , pgconn.Config {}, LangTypescript , []string {}, true , "" , fsys ))
133
+ assert .NoError (t , Run (context .Background (), projectId , pgconn.Config {}, LangTypescript , []string {}, true , "" , time . Second , fsys ))
133
134
// Validate api
134
135
assert .Empty (t , apitest .ListUnmatchedRequests ())
135
136
})
@@ -144,7 +145,7 @@ func TestGenLinkedCommand(t *testing.T) {
144
145
Get ("/v1/projects/" + projectId + "/types/typescript" ).
145
146
ReplyError (errNetwork )
146
147
// Run test
147
- err := Run (context .Background (), projectId , pgconn.Config {}, LangTypescript , []string {}, true , "" , fsys )
148
+ err := Run (context .Background (), projectId , pgconn.Config {}, LangTypescript , []string {}, true , "" , time . Second , fsys )
148
149
// Validate api
149
150
assert .ErrorIs (t , err , errNetwork )
150
151
assert .Empty (t , apitest .ListUnmatchedRequests ())
@@ -159,7 +160,7 @@ func TestGenLinkedCommand(t *testing.T) {
159
160
Get ("/v1/projects/" + projectId + "/types/typescript" ).
160
161
Reply (http .StatusServiceUnavailable )
161
162
// Run test
162
- assert .Error (t , Run (context .Background (), projectId , pgconn.Config {}, LangTypescript , []string {}, true , "" , fsys ))
163
+ assert .Error (t , Run (context .Background (), projectId , pgconn.Config {}, LangTypescript , []string {}, true , "" , time . Second , fsys ))
163
164
})
164
165
}
165
166
@@ -184,7 +185,7 @@ func TestGenRemoteCommand(t *testing.T) {
184
185
conn := pgtest .NewConn ()
185
186
defer conn .Close (t )
186
187
// Run test
187
- assert .NoError (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {"public" }, true , "" , afero .NewMemMapFs (), conn .Intercept ))
188
+ assert .NoError (t , Run (context .Background (), "" , dbConfig , LangTypescript , []string {"public" }, true , "" , time . Second , afero .NewMemMapFs (), conn .Intercept ))
188
189
// Validate api
189
190
assert .Empty (t , apitest .ListUnmatchedRequests ())
190
191
})
0 commit comments