mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: Add docker:test:setup
Rake task (#23430)
## What is the context here? The `docker.rake` Rakefile contains Rake tasks that are meant to be run in the `discourse/discourse_test:release` Docker image. For example, we have the `docker:test` Rake task that makes it easier to run the test suite for a particular Discourse commit. Why are we introducing a `docker:test:setup` Rake task? While we have the `docker:test` Rake task, it is very limited in the test commands that can be executed. It is very useful for automated testing but not very useful for running tests in the development environment. Therefore, we are introducing a `docker:test:setup` rake task that can be used to set up the test environment for running tests. The envisioned example usage is something like this: ``` docker run -d --name=discourse_test --entrypoint=/sbin/boot discourse/discourse_test:release docker exec -u discourse:discourse discourse_test ruby script/docker_test.rb --no-tests docker exec -u discourse:discourse discourse_test bundle exec rake docker:test:setup docker exec -u discourse:discourse discourse_test bundle exec rspec <path to file> ```
This commit is contained in:

committed by
GitHub

parent
ad58b6d604
commit
9caba30d5c
@ -24,6 +24,8 @@ while a = ARGV.pop
|
||||
end
|
||||
|
||||
if should_setup
|
||||
run "rm -rf #{DATA}"
|
||||
run "mkdir -p #{DATA}"
|
||||
run "#{BIN}/initdb -D #{DATA}"
|
||||
|
||||
run "echo fsync = off >> #{DATA}/postgresql.conf"
|
||||
@ -32,7 +34,7 @@ if should_setup
|
||||
end
|
||||
|
||||
if should_exec
|
||||
exec "#{BIN}/postmaster -D #{DATA}"
|
||||
exec "#{BIN}/postgres -D #{DATA}"
|
||||
elsif should_run
|
||||
run "#{BIN}/pg_ctl -D #{DATA} start"
|
||||
end
|
||||
|
Reference in New Issue
Block a user