summaryrefslogtreecommitdiff
path: root/qa/qa/service/shellout.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /qa/qa/service/shellout.rb
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
downloadgitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'qa/qa/service/shellout.rb')
-rw-r--r--qa/qa/service/shellout.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/qa/qa/service/shellout.rb b/qa/qa/service/shellout.rb
index 6efe50c4ae2..81cfaa125a9 100644
--- a/qa/qa/service/shellout.rb
+++ b/qa/qa/service/shellout.rb
@@ -33,6 +33,31 @@ module QA
end
end
end
+
+ def sql_to_docker_exec_cmd(sql, username, password, database, host, container)
+ <<~CMD
+ docker exec --env PGPASSWORD=#{password} #{container} \
+ bash -c "psql -U #{username} -d #{database} -h #{host} -c \\"#{sql}\\""
+ CMD
+ end
+
+ def wait_until_shell_command(cmd, **kwargs)
+ sleep_interval = kwargs.delete(:sleep_interval) || 1
+
+ Support::Waiter.wait_until(sleep_interval: sleep_interval, **kwargs) do
+ shell cmd do |line|
+ break true if yield line
+ end
+ end
+ end
+
+ def wait_until_shell_command_matches(cmd, regex, **kwargs)
+ wait_until_shell_command(cmd, kwargs) do |line|
+ QA::Runtime::Logger.debug(line.chomp)
+
+ line =~ regex
+ end
+ end
end
end
end