Commit 50d1519a by Leonard Gram

build: mysql integration testing on ci.

parent 21ecaae6
......@@ -12,6 +12,26 @@ aliases:
version: 2
jobs:
mysql-integration-test:
docker:
- image: circleci/golang:1.10
- image: circleci/mysql:5.6-ram
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: grafana_tests
MYSQL_USER: grafana
MYSQL_PASSWORD: password
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run: sudo apt update
- run: sudo apt install -y mysql-client
- run: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
- run: cat docker/blocks/mysql_tests/setup.sql | mysql -h 127.0.0.1 -P 3306 -u root -prootpass
- run:
name: mysql integration tests
command: 'GRAFANA_TEST_DB=mysql go test ./pkg/...'
codespell:
docker:
- image: circleci/python
......@@ -188,6 +208,8 @@ workflows:
filters: *filter-not-release
- test-backend:
filters: *filter-not-release
- mysql-integration-test:
filters: *filter-not-release
- deploy-master:
requires:
- build-all
......@@ -195,6 +217,7 @@ workflows:
- test-frontend
- codespell
- gometalinter
- mysql-integration-test
filters:
branches:
only: master
......@@ -210,6 +233,8 @@ workflows:
filters: *filter-only-release
- test-backend:
filters: *filter-only-release
- mysql-integration-test:
filters: *filter-only-release
- deploy-release:
requires:
- build-all
......@@ -217,4 +242,5 @@ workflows:
- test-frontend
- codespell
- gometalinter
- mysql-integration-test
filters: *filter-only-release
mysql:
image: mysql:latest
image: mysql:5.6
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: grafana
......
FROM mysql:latest
FROM mysql:5.6
ADD setup.sql /docker-entrypoint-initdb.d
CMD ["mysqld"]
\ No newline at end of file
CMD ["mysqld"]
......@@ -601,7 +601,7 @@ func TestMySQL(t *testing.T) {
Queries: []*tsdb.Query{
{
Model: simplejson.NewFromAny(map[string]interface{}{
"rawSql": `SELECT $__time(time), CONCAT(measurement, ' - value one') as metric, valueOne FROM metric_values ORDER BY 1`,
"rawSql": `SELECT $__time(time), CONCAT(measurement, ' - value one') as metric, valueOne FROM metric_values ORDER BY 1,2`,
"format": "time_series",
}),
RefId: "A",
......@@ -615,8 +615,8 @@ func TestMySQL(t *testing.T) {
So(queryResult.Error, ShouldBeNil)
So(len(queryResult.Series), ShouldEqual, 2)
So(queryResult.Series[0].Name, ShouldEqual, "Metric B - value one")
So(queryResult.Series[1].Name, ShouldEqual, "Metric A - value one")
So(queryResult.Series[0].Name, ShouldEqual, "Metric A - value one")
So(queryResult.Series[1].Name, ShouldEqual, "Metric B - value one")
})
Convey("When doing a metric query grouping by time should return correct series", func() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment