Run tests again and grant required database privilleges

This commit is contained in:
Pirate Praveen 2020-11-22 10:37:35 +00:00
parent c5dab90c1d
commit c7042f454c

16
debian/tests/spec vendored
View file

@ -23,20 +23,24 @@ export RAILS_ENV=test
export DB=postgres export DB=postgres
export INCLUDE_TEST_DEPENDS="true" export INCLUDE_TEST_DEPENDS="true"
# TODO: stop running autopkgtest till these gems are packaged
exit 0
echo "Installing test only dependencies from rubygems.org..."
cp ${SOURCE_TREE}/debian/Gemfile.autopkgtest .
BUNDLE_GEMFILE=Gemfile.autopkgtest bundle install
su gitlab -c "bundle install --local" su gitlab -c "bundle install --local"
su gitlab -c "mkdir -p tmp/tests/gitlab-shell" su gitlab -c "mkdir -p tmp/tests/gitlab-shell"
export dbname=gitlab_test export dbname=gitlab_test
export gitlab_user=gitlab
su postgres -c "createdb $dbname" su postgres -c "createdb $dbname"
# enable the pg_trgm extension # enable the pg_trgm extension
su postgres -c "psql -d $dbname -c \"CREATE EXTENSION IF NOT EXISTS pg_trgm;\"" || { su postgres -c "psql -d $dbname -c \"CREATE EXTENSION IF NOT EXISTS pg_trgm;\"" || {
exit 1 exit 1
} }
# enable the btree_gist extension
su postgres -c "psql -d $dbname -c \"CREATE EXTENSION IF NOT EXISTS btree_gist;\"" || {
exit 1
}
# Allow gitlab user required permissions
su postgres -c "psql -c \"GRANT ALL on schema public TO ${gitlab_user};\""
su postgres -c "psql -c \"GRANT ALL on database ${dbname} TO ${gitlab_user};\""
# gitlab user need to create files here
chown -R ${gitlab_user}: /usr/share/gitlab/db
su gitlab -c "bundle exec rake db:migrate" su gitlab -c "bundle exec rake db:migrate"
su gitlab -c "bundle exec rake -f ${SOURCE_TREE}/debian/tests/spec.rake" su gitlab -c "bundle exec rake -f ${SOURCE_TREE}/debian/tests/spec.rake"
#config 2/2 failed, controllers many failed #config 2/2 failed, controllers many failed