Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run integration test server as www-data user #260

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ setup-rust-android-targets:
aarch64-linux-android

run-wp-cli-command:
@docker exec wordpress /bin/bash -c "wp --allow-root $(ARGS)"
@docker exec --user www-data wordpress /bin/bash -c "wp $(ARGS)"

help:
@printf "%-40s %s\n" "Target" "Description"
Expand Down
2 changes: 2 additions & 0 deletions scripts/setup-test-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set -e
# be any weird permissions issues)
su -s /bin/bash www-data

wp package install wp-cli/restful

## Wait for the DB to be ready before attempting install – Docker can do this for us, but we get way better
## diagnostic information from `wp db check`, whereas if `wp core install` fails it won't tell us about issues
## like incompatible SSL cipher suites (which is a problem in the WP 5.7 image when used with MySQL 8+)
Expand Down
2 changes: 2 additions & 0 deletions scripts/start-wp-api-integration-tests-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
cd /app

cargo build --release -p wp_api_integration_tests_backend

su -s /bin/bash www-data
nohup ./target/release/wp_api_integration_tests_backend > ./target/release/wp_api_integration_tests_backend.log &
3 changes: 0 additions & 3 deletions wordpress.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ RUN mkdir -p /var/www/.wp-cli
ENV PATH="/root/.cargo/bin:${PATH}"
RUN chown -R www-data:www-data /var/www/.wp-cli/

# Run this command as root user since that's what the Docker will use when we run --http=http://localhost commands
RUN wp --allow-root package install wp-cli/restful

# Setup Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN rustup target add x86_64-linux-android i686-linux-android armv7-linux-androideabi aarch64-linux-android
Expand Down
3 changes: 1 addition & 2 deletions wp_cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ where
S: AsRef<OsStr>,
{
let mut c = Command::new("wp");
c.arg("--allow-root")
.arg("--http=http://localhost")
c.arg("--http=http://localhost")
.arg("--path=/var/www/html")
.arg("--format=json")
.args(args);
Expand Down
Loading