Skip to content

Commit 428cff5

Browse files
committed
chore: try fix sharing ci and fix comments
1 parent 968c664 commit 428cff5

File tree

11 files changed

+48
-29
lines changed

11 files changed

+48
-29
lines changed

.github/actions/artifact_download/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ runs:
5959
aws s3 cp \
6060
s3://databend-ci/${{ inputs.profile }}/${{ inputs.sha }}/${{ inputs.target }}/${{ inputs.category }}/ \
6161
${{ steps.info.outputs.path }}/ --recursive --exclude "*" --include "databend-*" --no-progress
62+
aws s3 cp \
63+
s3://databend-ci/${{ inputs.profile }}/${{ inputs.sha }}/${{ inputs.target }}/${{ inputs.category }}/ \
64+
${{ steps.info.outputs.path }}/ --recursive --exclude "*" --include "open-sharing" --no-progress || true
6265
6366
- name: make artifacts excutable
6467
shell: bash
6568
run: |
6669
chmod +x ${{ steps.info.outputs.path }}/databend-*
70+
chmod +x ${{ steps.info.outputs.path }}/open-sharing

scripts/ci/ci-run-stateful-tests-standalone-s3.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,19 @@ echo "calling test suite"
2626
echo "Starting standalone DatabendQuery(debug)"
2727
./scripts/ci/deploy/databend-query-standalone.sh
2828

29-
export ALLOW_SHARING=false
29+
# only expected to get adopted in stateful tests
30+
if [[ "$ALLOW_SHARING" == "true" ]]; then
31+
./scripts/ci/deploy/databend-query-sharing.sh
32+
fi
3033

3134
SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
3235
cd "$SCRIPT_PATH/../../tests" || exit
3336

3437
echo "Starting databend-test"
38+
3539
./databend-test $1 --mode 'standalone' --run-dir 1_stateful
40+
41+
# only expected to get adopted in stateful tests
42+
if [[ "$ALLOW_SHARING" == "true" ]]; then
43+
./databend-test $1 --mode 'standalone' --run-dir 3_stateful_sharing
44+
fi
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Copyright 2022 The Databend Authors.
3+
# SPDX-License-Identifier: Apache-2.0.
4+
set -e
5+
6+
SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
7+
cd "$SCRIPT_PATH/../../.." || exit
8+
BUILD_PROFILE=${BUILD_PROFILE:-debug}
9+
10+
echo "*************************************"
11+
echo "* Test on Databend openSharing endpoint *"
12+
echo "* it will start a node from another tenant *"
13+
echo "* Please make sure that S3 backend *"
14+
echo "* is ready, and configured properly. *"
15+
echo "*************************************"
16+
echo "Start open-sharing..."
17+
export TENANT=test_tenant
18+
nohup target/${BUILD_PROFILE}/open-sharing &
19+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 33003
20+
21+
echo 'Start databend-query...'
22+
export STORAGE_S3_ROOT=shared
23+
24+
nohup target/${BUILD_PROFILE}/databend-query -c scripts/ci/deploy/config/databend-query-node-shared.toml &
25+
26+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 53307

scripts/ci/deploy/databend-query-standalone.sh

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,3 @@ nohup target/${BUILD_PROFILE}/databend-query -c scripts/ci/deploy/config/databen
3030

3131
echo "Waiting on databend-query 10 seconds..."
3232
python3 scripts/ci/wait_tcp.py --timeout 5 --port 3307
33-
34-
# only expected to get adopted in stateful tests
35-
if [[ "$ALLOW_SHARING" == "true" ]]; then
36-
echo "*************************************"
37-
echo "* Test on Databend openSharing endpoint *"
38-
echo "* it will start a node from another tenant *"
39-
echo "* Please make sure that S3 backend *"
40-
echo "* is ready, and configured properly. *"
41-
echo "*************************************"
42-
echo "Start open-sharing..."
43-
export TENANT=test_tenant
44-
nohup target/${BUILD_PROFILE}/open-sharing &
45-
python3 scripts/ci/wait_tcp.py --timeout 5 --port 33003
46-
47-
echo 'Start databend-query...'
48-
export STORAGE_S3_ROOT=shared
49-
50-
nohup target/${BUILD_PROFILE}/databend-query -c scripts/ci/deploy/config/databend-query-node-shared.toml &
51-
52-
python3 scripts/ci/wait_tcp.py --timeout 5 --port 53307
53-
fi

src/binaries/opensharing/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ use sharing_endpoint::services::SharingServices;
2424
#[tokio::main]
2525
async fn main() -> Result<(), std::io::Error> {
2626
let config = Config::load().expect("cfgs");
27-
println!("config: {:?}", config);
28-
SharingServices::init(config)
27+
SharingServices::init(config.clone())
2928
.await
3029
.expect("failed to init sharing service");
3130
let app = Route::new()
@@ -35,8 +34,7 @@ async fn main() -> Result<(), std::io::Error> {
3534
)
3635
.with(SharingAuth);
3736

38-
// TODO(zhihanz): remove the hard coded port into a config
39-
Server::new(TcpListener::bind("127.0.0.1:33003"))
37+
Server::new(TcpListener::bind(config.share_endpoint_address))
4038
.run(app)
4139
.await
4240
}

src/query/sharing-endpoint/src/configs/inner.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use super::outer_v0::Config as OuterV0Config;
2020
#[derive(Clone, Debug, PartialEq, Eq)]
2121
pub struct Config {
2222
pub tenant: String,
23+
pub share_endpoint_address: String,
2324
pub storage: StorageConfig,
2425
}
2526

@@ -52,6 +53,7 @@ impl Default for Config {
5253
fn default() -> Self {
5354
Self {
5455
tenant: "".to_string(),
56+
share_endpoint_address: "".to_string(),
5557
storage: StorageConfig::default(),
5658
}
5759
}

src/query/sharing-endpoint/src/configs/outer_v0.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ use super::inner::Config as InnerConfig;
2828
pub struct Config {
2929
#[clap(long, default_value = "")]
3030
pub tenant: String,
31+
#[clap(long, default_value = "127.0.0.1:33003")]
32+
pub share_endpoint_address: String,
3133
// Storage backend config.
3234
#[clap(flatten)]
3335
pub storage: common_config::StorageConfig,
@@ -43,6 +45,7 @@ impl From<Config> for InnerConfig {
4345
fn from(x: Config) -> Self {
4446
InnerConfig {
4547
tenant: x.tenant,
48+
share_endpoint_address: x.share_endpoint_address,
4649
storage: x.storage.try_into().expect("StorageConfig"),
4750
}
4851
}
@@ -52,6 +55,7 @@ impl From<InnerConfig> for Config {
5255
fn from(inner: InnerConfig) -> Self {
5356
Self {
5457
tenant: inner.tenant,
58+
share_endpoint_address: inner.share_endpoint_address,
5559
storage: inner.storage.into(),
5660
}
5761
}

src/query/sharing-endpoint/src/handlers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub async fn presign_files(
3838
request_files,
3939
None,
4040
);
41-
println!("input: {:?}", input.clone());
4241
return match SharingAccessor::get_presigned_files(&input).await {
4342
Ok(output) => Ok(Json(output)),
4443
Err(e) => Err(BadRequest(e)),

src/query/sharing-endpoint/src/middlewares.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ impl<E: Endpoint> Endpoint for SharingAuthImpl<E> {
4141
// TODO(zhihanz) current implementation only used for stateless test
4242
// for production usage, we need to implement a middleware with JWT authentication
4343
async fn call(&self, mut req: Request) -> Result<Self::Output> {
44-
println!("req: {:?}", req);
4544

4645
// decode auth header from bearer base64
4746
let auth_header = req
@@ -54,7 +53,6 @@ impl<E: Endpoint> Endpoint for SharingAuthImpl<E> {
5453
let auth_header = auth_header[1];
5554
let auth_header = base64::decode(auth_header).unwrap();
5655
let auth_header = String::from_utf8(auth_header).unwrap();
57-
println!("auth_header: {:?}", auth_header);
5856
req.extensions_mut()
5957
.insert(Credentials { token: auth_header });
6058
// add json content type if not provided

0 commit comments

Comments
 (0)