Category: test
OSSUTIL 2.0 Minimal Viable TestGoals
- 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)
- View configuration
ossutil config get region
- List Buckets
ossutil ls
- 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
- 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
- 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 lsAt 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_IDor the region in the configuration file. - AK has no permission: confirm that the RAM policy allows
oss:*or minimal read/write permissions.