Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Cloud
MAS
clonemap
Commits
8629239b
Commit
8629239b
authored
Feb 16, 2021
by
Stefan Dähling
Browse files
test fix; graceful shutdown
parent
a52854af
Pipeline
#411602
passed with stages
in 4 minutes and 29 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pkg/ams/ams_test.go
View file @
8629239b
...
...
@@ -45,6 +45,7 @@ THE SOFTWARE.
package
ams
import
(
"context"
"log"
"net/http"
"os"
...
...
@@ -86,7 +87,7 @@ func TestAMS(t *testing.T) {
mux
:=
http
.
NewServeMux
()
mux
.
HandleFunc
(
"/api/"
,
ams
.
handleAPI
)
s
:=
&
http
.
Server
{
Addr
:
":1000
0
"
,
Addr
:
":1000
1
"
,
Handler
:
mux
,
}
...
...
@@ -123,7 +124,7 @@ func dummyClient(s *http.Server, t *testing.T) {
time
.
Sleep
(
time
.
Second
*
1
)
amsClient
:=
amscli
.
New
(
time
.
Second
*
60
,
time
.
Second
*
1
,
4
)
amsClient
.
Host
=
"localhost"
amsClient
.
Port
=
1000
0
amsClient
.
Port
=
1000
1
var
err
error
var
httpStatus
int
...
...
@@ -225,6 +226,8 @@ func dummyClient(s *http.Server, t *testing.T) {
t
.
Error
(
"Error GetAgencyConfig "
+
strconv
.
Itoa
(
httpStatus
))
}
s
.
Shutdown
(
nil
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
s
.
Shutdown
(
ctx
)
return
}
pkg/logger/logger_test.go
View file @
8629239b
...
...
@@ -45,6 +45,7 @@ THE SOFTWARE.
package
logger
import
(
"context"
"net/http"
"os"
"testing"
...
...
@@ -83,6 +84,8 @@ func dummyClient(s *http.Server, t *testing.T) {
time
.
Sleep
(
time
.
Second
*
1
)
//TODO
s
.
Shutdown
(
nil
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
30
*
time
.
Second
)
defer
cancel
()
s
.
Shutdown
(
ctx
)
return
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment