Skip to content

Commit

Permalink
ci: Add test case for webdav with basic auth (#1327)
Browse files Browse the repository at this point in the history
* ci: Add test case for webdav with basic auth

Signed-off-by: Xuanwo <[email protected]>

* Ignore fixtures files

Signed-off-by: Xuanwo <[email protected]>

* Fix tests

Signed-off-by: Xuanwo <[email protected]>

* Fix CI

Signed-off-by: Xuanwo <[email protected]>

---------

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Feb 12, 2023
1 parent d27af0a commit 1b7c403
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 14 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/service_test_webdav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,40 @@ jobs:
RUST_LOG: debug
OPENDAL_WEBDAV_TEST: on
OPENDAL_WEBDAV_ENDPOINT: http://127.0.0.1:8080

nginx_with_password:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Start nginx
shell: bash
run: |
mkdir -p /tmp/static
cp `pwd`/src/services/webdav/fixtures/htpasswd /tmp/htpasswd
nginx -c `pwd`/src/services/webdav/fixtures/nginx-with-basic-auth.conf
- name: Test empty password
shell: bash
run: cargo test webdav --features compress -- --show-output
env:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_WEBDAV_TEST: on
OPENDAL_WEBDAV_ENDPOINT: http://127.0.0.1:8080
OPENDAL_WEBDAV_USERNAME: foo

- name: Test with password
shell: bash
run: cargo test webdav --features compress -- --show-output
env:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_WEBDAV_TEST: on
OPENDAL_WEBDAV_ENDPOINT: http://127.0.0.1:8080
OPENDAL_WEBDAV_USERNAME: bar
OPENDAL_WEBDAV_PASSWORD: bar
1 change: 1 addition & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ header:
- "**/*.toml"
- "**/*.lock"
- "**/*.tldr"
- "**/fixtures/**"
- "target/**"
- "**/target/**"
# Ignore test data
Expand Down
2 changes: 2 additions & 0 deletions src/services/webdav/fixtures/htpasswd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foo:$2y$10$GxAX8rC4qDTymm1AxocMmeWIT3ILwGg8Bk.U.SdMVbk7.iH5Cvf9y
bar:$2y$10$lNipq5OoOCIoFphWtGsTD./Lw323C0bNBKaPjcR/deoS3OwxJD.qS
25 changes: 25 additions & 0 deletions src/services/webdav/fixtures/nginx-with-basic-auth.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error_log /tmp/error.log;
pid /tmp/nginx.pid;

events {
worker_connections 1024;
}

http {
server {
listen 127.0.0.1:8080;
server_name localhost;
access_log /tmp/access.log;
root /tmp/static;

location / {
client_body_temp_path /tmp;
log_not_found off;
dav_methods PUT DELETE;
create_full_put_path on;
client_max_body_size 1024M;
auth_basic "Administrator’s Area";
auth_basic_user_file /tmp/htpasswd;
}
}
}
14 changes: 0 additions & 14 deletions src/services/webdav/fixtures/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2022 Datafuse Labs.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

error_log /tmp/error.log;
pid /tmp/nginx.pid;

Expand Down

1 comment on commit 1b7c403

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-4laothqsn-databend.vercel.app

Built with commit 1b7c403.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.