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

feat(services/sftp): setup integration tests #2192

Merged
merged 67 commits into from
May 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3904988
feat(services/sftp): setup integration tests
silver-ymz May 2, 2023
2a55c6f
add checkout
silver-ymz May 2, 2023
270740c
make sshd run in background
silver-ymz May 2, 2023
5006595
add public key
silver-ymz May 2, 2023
44ef7bd
change keygen
silver-ymz May 2, 2023
53b2c4f
change keygen
silver-ymz May 2, 2023
9fde890
fix wrong cwd
silver-ymz May 2, 2023
44dfe39
fix wrong command
silver-ymz May 2, 2023
1cfaea6
fix wrong premission
silver-ymz May 2, 2023
b3bc43d
fix
silver-ymz May 2, 2023
30501cd
fix
silver-ymz May 2, 2023
68d218d
fix
silver-ymz May 2, 2023
0d76502
fix
silver-ymz May 2, 2023
aaefe22
fix
silver-ymz May 2, 2023
39b9000
try using docker
silver-ymz May 2, 2023
adf6e8c
fix wrong container args
silver-ymz May 2, 2023
9b81bd2
fix wrong container args
silver-ymz May 2, 2023
5df5c50
fix wrong container
silver-ymz May 2, 2023
c8f458a
fix wrong container
silver-ymz May 2, 2023
baa892f
fix wrong known hosts
silver-ymz May 2, 2023
0903156
try print ssh connect info
silver-ymz May 2, 2023
d681fbb
fix wrong permission
silver-ymz May 2, 2023
fc37fd4
Make sftp running
Xuanwo May 2, 2023
aa3c3f4
Ignore known host
Xuanwo May 2, 2023
6a13aae
fix hotkey auth
silver-ymz May 2, 2023
8716661
Set timeout for test job
Xuanwo May 2, 2023
f191db0
remove bb8
silver-ymz May 3, 2023
838206a
support self defined known hosts strategy
silver-ymz May 3, 2023
7dde577
change key path to absolute path
silver-ymz May 3, 2023
9aa502b
fix syntax error
silver-ymz May 3, 2023
6f07b65
fix hotkeys auth
silver-ymz May 3, 2023
b275352
wait sshd start
silver-ymz May 3, 2023
72a206d
Make sftp working first
Xuanwo May 3, 2023
6d8f3b7
No need to wait
Xuanwo May 3, 2023
3541379
Use absolute path
Xuanwo May 3, 2023
5f73517
No need to check
Xuanwo May 3, 2023
c908b09
Merge branch 'main' into feat/add-sftp-ci
Xuanwo May 3, 2023
6d11a12
Try debug
Xuanwo May 3, 2023
30c0f24
Merge branch 'feat/add-sftp-ci' of https://github.com/silver-ymz/incu…
Xuanwo May 3, 2023
a03409e
give dict write premission
silver-ymz May 3, 2023
1d0c85d
pass hotkey auth
silver-ymz May 3, 2023
2265346
wait sshd open
silver-ymz May 3, 2023
e0c0a6d
fix wrong env variable
silver-ymz May 3, 2023
d587b5f
remove change cwd
silver-ymz May 3, 2023
4803c1f
try previous impl. If not success, I will revert back then
silver-ymz May 3, 2023
d3dfcbc
fix format
silver-ymz May 3, 2023
8bb99f6
simplify ci file
silver-ymz May 3, 2023
f7a2bc5
adapt to new api
silver-ymz May 4, 2023
9e7f01c
Merge branch 'main' into feat/add-sftp-ci
silver-ymz May 4, 2023
4ca73db
remove owning_ref
silver-ymz May 5, 2023
b03fe88
change to single connection, but exist error
silver-ymz May 5, 2023
5019f09
Boxing connect_sftp
silver-ymz May 7, 2023
a986bc7
add docs for max file descriptors
silver-ymz May 8, 2023
792abb9
Merge branch 'main' into feat/add-sftp-ci
silver-ymz May 8, 2023
e02d486
Merge branch 'main' into feat/add-sftp-ci
silver-ymz May 8, 2023
2cc5945
change Pager to Option<SftpPager>
silver-ymz May 8, 2023
4cb25e3
remove timeout
silver-ymz May 8, 2023
407afbb
typo
silver-ymz May 8, 2023
419038a
Merge branch 'main' into feat/add-sftp-ci
silver-ymz May 8, 2023
f50251d
add log for sftp-client
silver-ymz May 8, 2023
cf17af9
add env_filter for log
silver-ymz May 9, 2023
999bcf5
Merge branch 'main' into feat/add-sftp-ci
silver-ymz May 9, 2023
f835361
fix merge typo
silver-ymz May 9, 2023
bf19717
test for PR #77 in openssh-sftp-client
silver-ymz May 13, 2023
63b4b41
merge main
silver-ymz May 13, 2023
b3b6063
update branch
silver-ymz May 13, 2023
4dfe5cf
Bump openssh-sftp-client to v0.13.4
silver-ymz May 13, 2023
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ OPENDAL_SFTP_ENDPOINT=ssh://<endpoint>
OPENDAL_SFTP_ROOT=/path/to/dir
OPENDAL_SFTP_USER=<user>
OPENDAL_SFTP_KEY=<key_path>
OPENDAL_SFTP_KNOWN_HOSTS_STRATEGY=<accept|add|strict>
# sled
OPENDAL_SLED_TEST=false
OPENDAL_SLED_DATADIR=/path/to/database
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/service_test_sftp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.

name: Service Test Sftp

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "core/src/**"
- "core/tests/**"
- "!core/src/docs/**"
- "!core/src/services/**"
- "core/src/services/sftp/**"
- ".github/workflows/service_test_sftp.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

jobs:
sftp-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup sftp
run: |
mkdir -p target/ssh
ssh-keygen -t rsa -b 4096 -f target/ssh/id_rsa -q -N "" < /dev/null
docker run \
-v `pwd`/target/ssh/id_rsa.pub:/home/foo/.ssh/keys/id_rsa.pub:ro \
--ulimit nofile=65536:65536 \
-p 2222:22 -d atmoz/sftp \
foo::::upload

- name: Setup Rust toolchain
uses: ./.github/actions/setup
- name: Test
shell: bash
timeout-minutes: 10
working-directory: core
run: cargo test sftp --features services-sftp -- --show-output
env:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_SFTP_TEST: on
OPENDAL_SFTP_ENDPOINT: ssh://127.0.0.1:2222
OPENDAL_SFTP_ROOT: /upload/sftp_test/
OPENDAL_SFTP_USER: foo
OPENDAL_SFTP_KEY: ${{ github.workspace }}/target/ssh/id_rsa
OPENDAL_SFTP_KNOWN_HOSTS_STRATEGY: accept
51 changes: 27 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ services-s3 = [
services-sftp = [
"dep:openssh",
"dep:openssh-sftp-client",
"dep:bb8",
"dep:owning_ref",
"dep:dirs",
"futures/executor",
]
services-sled = ["dep:sled"]
Expand Down Expand Up @@ -171,6 +170,7 @@ bb8 = { version = "0.8", optional = true }
bytes = "1.2"
chrono = "0.4.24"
dashmap = { version = "5.4", optional = true }
dirs = { version = "5.0.1", optional = true }
flagset = "0.4"
futures = { version = "0.3", default-features = false, features = ["alloc"] }
hdrs = { version = "0.2", optional = true, features = ["async_file"] }
Expand All @@ -185,9 +185,11 @@ minitrace = { version = "0.4.0", optional = true }
moka = { version = "0.10", optional = true, features = ["future"] }
once_cell = "1"
openssh = { version = "0.9.9", optional = true }
openssh-sftp-client = { version = "0.12.2", optional = true }
openssh-sftp-client = { version = "0.13.4", optional = true, features = [
"openssh",
"tracing",
] }
opentelemetry = { version = "0.19.0", optional = true }
owning_ref = { version = "0.4.1", optional = true }
parking_lot = "0.12"
percent-encoding = "2"
pin-project = "1"
Expand Down Expand Up @@ -229,5 +231,8 @@ sha2 = "0.10"
size = "0.4"
tokio = { version = "1.27", features = ["fs", "macros", "rt-multi-thread"] }
tracing-opentelemetry = "0.17"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-subscriber = { version = "0.3", features = [
silver-ymz marked this conversation as resolved.
Show resolved Hide resolved
"env-filter",
"tracing-log",
] }
wiremock = "0.5"
Loading