| 1 |
# Copyright 2019 The Go Cloud Development Kit Authors |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
# Tests of the gocdk-blob program. |
| 16 |
|
| 17 |
# ROOTDIR_URL is a platform-specific environment variable set |
| 18 |
# in main_test.go. |
| 19 |
|
| 20 |
# Create a subdirectory so we can use fileblob. |
| 21 |
$ mkdir bucket |
| 22 |
|
| 23 |
# List an empty bucket: valid, but no output. |
| 24 |
$ gocdk-blob ls ${ROOTDIR_URL}/bucket |
| 25 |
|
| 26 |
$ fecho hello.txt hello world |
| 27 |
$ gocdk-blob upload ${ROOTDIR_URL}/bucket hw < hello.txt |
| 28 |
|
| 29 |
$ gocdk-blob ls ${ROOTDIR_URL}/bucket |
| 30 |
hw |
| 31 |
|
| 32 |
$ gocdk-blob download ${ROOTDIR_URL}/bucket hw |
| 33 |
hello world |
| 34 |
|
| 35 |
# Error downloading a bucket that doesn't exist. |
| 36 |
# For now we can't use this test case, because the output won't be the same across operating systems. |
| 37 |
#$ gocdk-blob download ${ROOTDIR_URL}/bucket noexist --> FAIL |
| 38 |
#gocdk-blob: Failed to read "noexist": blob (code=NotFound): stat ${SLASHDIR}/bucket/noexist: no such file or directory |
| 39 |
|