SuperAPI AI Directory

alicloud-storage-oss-ossutil-test

Testing & quality

View repository

Updated 10-15 14:25

About this skill

Category: test

OSSUTIL 2.0 Minimal Viable Test

Goals

  • Verify that the AK/Region configuration is correct.
  • Verify OSS access (list buckets, upload, download).

Prerequisites

  • AK is configured (environment variables or ~/.alibabacloud/credentials)。
  • A readable and writable OSS Bucket is prepared.

Test Steps (Minimal)

  1. View configuration
ossutil config get region
  1. List Buckets
ossutil ls
  1. Select a bucket and list objects by that bucket's region (explicit region + endpoint)
# 示例(按实际 bucket 地域替换)
ossutil ls oss://<bucket> -r --short-format --region cn-shanghai -e https://oss-cn-shanghai.aliyuncs.com --limited-num 20
  1. Upload a small file
echo "ossutil-test" > /tmp/ossutil-test.txt
ossutil cp /tmp/ossutil-test.txt oss://<bucket>/tests/ossutil-test.txt --region cn-shanghai -e https://oss-cn-shanghai.aliyuncs.com
  1. Download and verify
ossutil cp oss://<bucket>/tests/ossutil-test.txt /tmp/ossutil-test-down.txt --region cn-shanghai -e https://oss-cn-shanghai.aliyuncs.com
cat /tmp/ossutil-test-down.txt

Expected Results

  • ossutil ls At least one bucket can be returned, or a no-permission explanation is given.
  • After specifying --region + -e , listing objects returns normally.
  • Upload/download succeeds, and the file contents are identical.

Common failures

  • Region mismatch: confirm ALIBABACLOUD_REGION_ID or the region in the configuration file.
  • AK has no permission: confirm that the RAM policy allows oss:* or minimal read/write permissions.