Skip to content

Commit

Permalink
feat: configure initial sp version (#883)
Browse files Browse the repository at this point in the history
* feat: configure initial sp version

* fix(test): update blob paths used in storage.it.ITStorageTest#testDownloadPublicBlobWithoutAuthentication (#759)

Port of googleapis/google-cloud-go#3806

Fixes #755

* test: remove error string matching (#861)

It looks like the text for this error on the backend has changed
(sometimes) from "Precondition Failed" to "At least one of the
pre-conditions you specified did not hold". I don't think it's
really necessary to check the exact message in any case given
that we do check for a code of 412, which implies a precondition
failure. I added a check of the error Reason instead,  which is more
standardized.

Fixes #853

Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com>
Co-authored-by: Chris Cotter <cjcotter@google.com>
  • Loading branch information
3 people authored Jun 17, 2021
1 parent 12bd62c commit e245942
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 58 deletions.
114 changes: 61 additions & 53 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,79 +1,87 @@
on:
'on':
push:
branches:
- master
pull_request:
- 1.111.3-patch
pull_request: null
name: ci
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
java: [7, 8, 11]
java:
- 7
- 8
- 11
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: test
- name: coverage
uses: codecov/codecov-action@v1
with:
name: actions ${{matrix.java}}
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: test
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.bat
env:
JOB_TYPE: test
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.bat
env:
JOB_TYPE: test
dependencies:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11]
java:
- 8
- 11
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- run: java -version
- run: .kokoro/dependencies.sh
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- run: java -version
- run: .kokoro/dependencies.sh
linkage-monitor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/linkage-monitor.sh
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- name: Install artifacts to local Maven repository
run: .kokoro/build.sh
shell: bash
- name: >-
Validate any conflicts with regard to com.google.cloud:libraries-bom
(latest release)
uses: >-
GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: lint
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: lint
clirr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: clirr
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 8
- run: java -version
- run: .kokoro/build.sh
env:
JOB_TYPE: clirr
Original file line number Diff line number Diff line change
Expand Up @@ -2053,11 +2053,11 @@ public void testDownloadPublicBlobWithoutAuthentication() {

// try to download blobs from a public bucket
String landsatBucket = "gcp-public-data-landsat";
String landsatPrefix = "LC08/PRE/044/034/LC80440342016259LGN00/";
String landsatBlob = landsatPrefix + "LC80440342016259LGN00_MTL.txt";
String landsatPrefix = "LC08/01/001/002/LC08_L1GT_001002_20160817_20170322_01_T2/";
String landsatBlob = landsatPrefix + "LC08_L1GT_001002_20160817_20170322_01_T2_ANG.txt";
byte[] bytes = unauthorizedStorage.readAllBytes(landsatBucket, landsatBlob);

assertThat(bytes.length).isEqualTo(7903);
assertThat(bytes.length).isEqualTo(117255);
int numBlobs = 0;
Iterator<Blob> blobIterator =
unauthorizedStorage
Expand All @@ -2068,7 +2068,7 @@ public void testDownloadPublicBlobWithoutAuthentication() {
numBlobs++;
blobIterator.next();
}
assertThat(numBlobs).isEqualTo(13);
assertThat(numBlobs).isEqualTo(14);

// try to download blobs from a bucket that requires authentication
// authenticated client will succeed
Expand Down Expand Up @@ -3291,7 +3291,7 @@ public void testBlobReload() throws Exception {
fail("StorageException was expected");
} catch (StorageException e) {
assertEquals(412, e.getCode());
assertEquals("Precondition Failed", e.getMessage());
assertEquals("conditionNotMet", e.getReason());
}

Blob updated = blob.reload();
Expand Down

0 comments on commit e245942

Please sign in to comment.