Fix integration tests for mysql and postgres (#50867)
* Fix integration tests for mysql and postgres * Package by package testing * Adding make gen-go to the postgres and mysql integration step * Rewrite command for backend integration tests * Diffentiate command for OSS and enterprise * Add wire-install as dependant for OSS integration tests * set GRAFANA_TEST_DB variable in the go test command * No verbose output * Remove redundant env var * Try fixing the tests * Trying stg else * Remove verbose Co-authored-by: Sofia Papagiannaki <sofia@grafana.com>
This commit is contained in:
co-authored by
Sofia Papagiannaki
parent
b2852205a0
commit
335ce44890
@@ -870,7 +870,21 @@ def publish_images_step(edition, ver_mode, mode, docker_repo, trigger=None):
|
||||
|
||||
def postgres_integration_tests_step(edition, ver_mode):
|
||||
deps = []
|
||||
deps.extend(['grabpl'])
|
||||
cmds = [
|
||||
'apt-get update',
|
||||
'apt-get install -yq postgresql-client',
|
||||
'dockerize -wait tcp://postgres:5432 -timeout 120s',
|
||||
'psql -p 5432 -h postgres -U grafanatest -d grafanatest -f ' +
|
||||
'devenv/docker/blocks/postgres_tests/setup.sql',
|
||||
# Make sure that we don't use cached results for another database
|
||||
'go clean -testcache',
|
||||
]
|
||||
if edition == 'oss':
|
||||
deps.extend(['wire-install'])
|
||||
cmds.extend(["go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic -timeout=30m {}'"])
|
||||
else:
|
||||
deps.extend(['grabpl'])
|
||||
cmds.extend(['./bin/grabpl integration-tests --database postgres'])
|
||||
return {
|
||||
'name': 'postgres-integration-tests',
|
||||
'image': build_image,
|
||||
@@ -880,22 +894,26 @@ def postgres_integration_tests_step(edition, ver_mode):
|
||||
'GRAFANA_TEST_DB': 'postgres',
|
||||
'POSTGRES_HOST': 'postgres',
|
||||
},
|
||||
'commands': [
|
||||
'apt-get update',
|
||||
'apt-get install -yq postgresql-client',
|
||||
'dockerize -wait tcp://postgres:5432 -timeout 120s',
|
||||
'psql -p 5432 -h postgres -U grafanatest -d grafanatest -f ' +
|
||||
'devenv/docker/blocks/postgres_tests/setup.sql',
|
||||
# Make sure that we don't use cached results for another database
|
||||
'go clean -testcache',
|
||||
'./bin/grabpl integration-tests --database postgres',
|
||||
],
|
||||
'commands': cmds,
|
||||
}
|
||||
|
||||
|
||||
def mysql_integration_tests_step(edition, ver_mode):
|
||||
deps = []
|
||||
deps.extend(['grabpl'])
|
||||
cmds = [
|
||||
'apt-get update',
|
||||
'apt-get install -yq default-mysql-client',
|
||||
'dockerize -wait tcp://mysql:3306 -timeout 120s',
|
||||
'cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root -prootpass',
|
||||
# Make sure that we don't use cached results for another database
|
||||
'go clean -testcache',
|
||||
]
|
||||
if edition == 'oss':
|
||||
deps.extend(['wire-install'])
|
||||
cmds.extend(["go list './pkg/...' | xargs -I {} sh -c 'go test -run Integration -covermode=atomic -timeout=30m {}'"])
|
||||
else:
|
||||
deps.extend(['grabpl'])
|
||||
cmds.extend(['./bin/grabpl integration-tests --database mysql'])
|
||||
return {
|
||||
'name': 'mysql-integration-tests',
|
||||
'image': build_image,
|
||||
@@ -904,15 +922,7 @@ def mysql_integration_tests_step(edition, ver_mode):
|
||||
'GRAFANA_TEST_DB': 'mysql',
|
||||
'MYSQL_HOST': 'mysql',
|
||||
},
|
||||
'commands': [
|
||||
'apt-get update',
|
||||
'apt-get install -yq default-mysql-client',
|
||||
'dockerize -wait tcp://mysql:3306 -timeout 120s',
|
||||
'cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root -prootpass',
|
||||
# Make sure that we don't use cached results for another database
|
||||
'go clean -testcache',
|
||||
'./bin/grabpl integration-tests --database mysql',
|
||||
],
|
||||
'commands': cmds,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user