mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 00:18:27 +00:00
add mysql and redis services (#471)
enable redis and mysql tests in CircleCI environment switch redis test to use UTC time - https://github.com/golang/go/issues/17885
This commit is contained in:
parent
0b6df0cd73
commit
2a9e27e426
2 changed files with 19 additions and 14 deletions
|
|
@ -11,6 +11,7 @@ dependencies:
|
|||
- docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_PASSWORD
|
||||
override:
|
||||
- docker pull kolide/kolide-builder:1.7
|
||||
- docker pull redis
|
||||
- docker run -v $(pwd):/go/src/github.com/kolide/kolide-ose -v /home/ubuntu/.go_workspace/pkg:/go/pkg kolide/kolide-builder:1.7 --deps
|
||||
cache_directories:
|
||||
- "vendor"
|
||||
|
|
@ -18,7 +19,10 @@ dependencies:
|
|||
|
||||
test:
|
||||
override:
|
||||
- docker run -v $(pwd):/go/src/github.com/kolide/kolide-ose -v /home/ubuntu/.go_workspace/pkg:/go/pkg kolide/kolide-builder:1.7 --build
|
||||
- docker run -d --name redis redis
|
||||
- docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=toor -e MYSQL_DATABASE=kolide -e MYSQL_USER=kolide -e MYSQL_PASSWORD=kolide mysql:5.7
|
||||
- docker run --link redis:redis --link mysql:mysql -e MYSQL_TEST=true -e REDIS_TEST=true -v $(pwd):/go/src/github.com/kolide/kolide-ose -v /home/ubuntu/.go_workspace/pkg:/go/pkg kolide/kolide-builder:1.7 --build
|
||||
- docker stop $(docker ps -a -q)
|
||||
|
||||
deployment:
|
||||
development:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package pubsub
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"runtime"
|
||||
|
|
@ -75,7 +76,7 @@ func setupRedis(t *testing.T) (store *redisQueryResults, teardown func()) {
|
|||
)
|
||||
|
||||
if a, ok := os.LookupEnv("REDIS_PORT_6379_TCP_ADDR"); ok {
|
||||
addr = a
|
||||
addr = fmt.Sprintf("%s:6379", a)
|
||||
}
|
||||
|
||||
store = NewRedisQueryResults(NewRedisPool(addr, password))
|
||||
|
|
@ -98,8 +99,8 @@ func testQueryResultsStoreErrors(t *testing.T, store kolide.QueryResultStore) {
|
|||
ResultJSON: json.RawMessage(`{"bing":"fds"}`),
|
||||
Host: kolide.Host{
|
||||
ID: 4,
|
||||
UpdatedAt: time.Now(),
|
||||
DetailUpdateTime: time.Now(),
|
||||
UpdatedAt: time.Now().UTC(),
|
||||
DetailUpdateTime: time.Now().UTC(),
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
@ -123,8 +124,8 @@ func testQueryResultsStore(t *testing.T, store kolide.QueryResultStore) {
|
|||
// Note these times need to be set to avoid
|
||||
// issues with roundtrip serializing the zero
|
||||
// time value. See https://goo.gl/CCEs8x
|
||||
UpdatedAt: time.Now(),
|
||||
DetailUpdateTime: time.Now(),
|
||||
UpdatedAt: time.Now().UTC(),
|
||||
DetailUpdateTime: time.Now().UTC(),
|
||||
},
|
||||
},
|
||||
kolide.DistributedQueryResult{
|
||||
|
|
@ -132,8 +133,8 @@ func testQueryResultsStore(t *testing.T, store kolide.QueryResultStore) {
|
|||
ResultJSON: json.RawMessage(`{"whoo":"wahh"}`),
|
||||
Host: kolide.Host{
|
||||
ID: 3,
|
||||
UpdatedAt: time.Now(),
|
||||
DetailUpdateTime: time.Now(),
|
||||
UpdatedAt: time.Now().UTC(),
|
||||
DetailUpdateTime: time.Now().UTC(),
|
||||
},
|
||||
},
|
||||
kolide.DistributedQueryResult{
|
||||
|
|
@ -141,8 +142,8 @@ func testQueryResultsStore(t *testing.T, store kolide.QueryResultStore) {
|
|||
ResultJSON: json.RawMessage(`{"bing":"fds"}`),
|
||||
Host: kolide.Host{
|
||||
ID: 4,
|
||||
UpdatedAt: time.Now(),
|
||||
DetailUpdateTime: time.Now(),
|
||||
UpdatedAt: time.Now().UTC(),
|
||||
DetailUpdateTime: time.Now().UTC(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -159,8 +160,8 @@ func testQueryResultsStore(t *testing.T, store kolide.QueryResultStore) {
|
|||
ResultJSON: json.RawMessage(`{"tim":"tom"}`),
|
||||
Host: kolide.Host{
|
||||
ID: 1,
|
||||
UpdatedAt: time.Now(),
|
||||
DetailUpdateTime: time.Now(),
|
||||
UpdatedAt: time.Now().UTC(),
|
||||
DetailUpdateTime: time.Now().UTC(),
|
||||
},
|
||||
},
|
||||
kolide.DistributedQueryResult{
|
||||
|
|
@ -168,8 +169,8 @@ func testQueryResultsStore(t *testing.T, store kolide.QueryResultStore) {
|
|||
ResultJSON: json.RawMessage(`{"slim":"slam"}`),
|
||||
Host: kolide.Host{
|
||||
ID: 3,
|
||||
UpdatedAt: time.Now(),
|
||||
DetailUpdateTime: time.Now(),
|
||||
UpdatedAt: time.Now().UTC(),
|
||||
DetailUpdateTime: time.Now().UTC(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue