test: ignore empty s3 bucket (#529)

This commit is contained in:
Ning Sun
2022-11-16 11:35:12 +08:00
committed by GitHub
parent e823cde6ff
commit 173a8f67a1
2 changed files with 12 additions and 12 deletions

View File

@@ -104,18 +104,20 @@ async fn test_fs_backend() -> Result<()> {
#[tokio::test]
async fn test_s3_backend() -> Result<()> {
logging::init_default_ut_logging();
if env::var("GT_S3_BUCKET").is_ok() {
logging::info!("Running s3 test.");
if let Ok(bucket) = env::var("GT_S3_BUCKET") {
if !bucket.is_empty() {
logging::info!("Running s3 test.");
let accessor = s3::Builder::default()
.access_key_id(&env::var("GT_S3_ACCESS_KEY_ID")?)
.secret_access_key(&env::var("GT_S3_ACCESS_KEY")?)
.bucket(&env::var("GT_S3_BUCKET")?)
.build()?;
let accessor = s3::Builder::default()
.access_key_id(&env::var("GT_S3_ACCESS_KEY_ID")?)
.secret_access_key(&env::var("GT_S3_ACCESS_KEY")?)
.bucket(&bucket)
.build()?;
let store = ObjectStore::new(accessor);
test_object_crud(&store).await?;
test_object_list(&store).await?;
let store = ObjectStore::new(accessor);
test_object_crud(&store).await?;
test_object_list(&store).await?;
}
}
Ok(())

View File

@@ -11,5 +11,3 @@
// 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.