From 36cbcb5448975f4316e087892ec6eb7d1e4884ab Mon Sep 17 00:00:00 2001 From: hoslo Date: Sun, 25 Feb 2024 13:03:37 +1000 Subject: [PATCH] feat(services/yandex_disk): setup test for yandex disk --- .../yandex_disk/yandex_disk/action.yml | 29 +++++++++++++++++++ core/src/services/yandex_disk/error.rs | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 .github/services/yandex_disk/yandex_disk/action.yml diff --git a/.github/services/yandex_disk/yandex_disk/action.yml b/.github/services/yandex_disk/yandex_disk/action.yml new file mode 100644 index 000000000000..b76cf1c0e9c5 --- /dev/null +++ b/.github/services/yandex_disk/yandex_disk/action.yml @@ -0,0 +1,29 @@ +# 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: yandex_disk +description: 'Behavior test for Yandex Disk.' + +runs: + using: "composite" + steps: + - name: Setup + uses: 1password/load-secrets-action@v1 + with: + export-env: true + env: + OPENDAL_YANDEX_DISK_ACCESS_TOKEN: op://services/yandex_disk/access_token diff --git a/core/src/services/yandex_disk/error.rs b/core/src/services/yandex_disk/error.rs index c56c40e84ff5..05020e64d799 100644 --- a/core/src/services/yandex_disk/error.rs +++ b/core/src/services/yandex_disk/error.rs @@ -43,6 +43,8 @@ pub async fn parse_error(resp: Response) -> Result { 400 => (ErrorKind::InvalidInput, false), 410 | 403 => (ErrorKind::PermissionDenied, false), 404 => (ErrorKind::NotFound, false), + // We should retry it when we get 423 error. + 423 => (ErrorKind::RateLimited, true), 499 => (ErrorKind::Unexpected, true), 503 | 507 => (ErrorKind::Unexpected, true), _ => (ErrorKind::Unexpected, false),