-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Import firestore conformance tests from googleapis/conformance-tests@32fd66cf7dffe8431643f08b5944108ac10c8bc2 #5541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BenWhitehead
merged 1 commit into
googleapis:master
from
BenWhitehead:firestore/conformance-tests-migration/step2
Jul 10, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "google-cloud-testing/google-cloud-conformance-tests/conformance-tests"] | ||
| path = google-cloud-testing/google-cloud-conformance-tests/conformance-tests | ||
| url = git@github.com:googleapis/conformance-tests.git | ||
52 changes: 52 additions & 0 deletions
52
google-cloud-testing/google-cloud-conformance-tests/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Google cloud conformance tests | ||
| This maven module is intended to function as a central location for integration with | ||
| [googleapis/conformance-tests](https://github.com/googleapis/conformance-tests). | ||
|
|
||
| In this directory `conformance-tests` which is a git-submodule, containing the reference for which | ||
| the various conformance test resources are updated to. | ||
|
|
||
| ## Updating conformance-tests | ||
|
|
||
| #### Prerequisites | ||
|
|
||
| Part of the process of updating the conformance tests involves running maven a maven build for | ||
| this module. Ensure that all parent modules have been installed locally so the build can run. | ||
| ```bash | ||
| pushd cd ../../ | ||
| mvn -Dmaven.test.skip.exec=true install | ||
| popd | ||
| ``` | ||
|
|
||
| #### Performing the update | ||
|
|
||
| To update the conformance tests run the following commands from this module directory: | ||
| ```bash | ||
| pushd conformance-tests | ||
| git pull | ||
| popd | ||
| ./generate-conformance-tests.sh | ||
| git add . | ||
| ``` | ||
|
|
||
| If an error is encountered while generating the new resources please check the `generate.log` | ||
| written to the working directory. | ||
|
|
||
|
|
||
| ## Test Suites | ||
|
|
||
| ### Firestore | ||
|
|
||
| The conformance test suites for Firestore are located in the `com.google.cloud.conformance.firestore` | ||
| package. | ||
|
|
||
| #### Files | ||
|
|
||
| There are a number of files that together define the format of the tests as well as the tests | ||
| themselves. | ||
|
|
||
| * `src/main/java/com/google/cloud/conformance/firestore/v1/TestDefinition.java` | ||
| * The generated protobuf objects used to read the tests definitions | ||
| * `src/main/proto/google/cloud/conformance/firestore/v1/tests.proto` | ||
| * The proto definition for the tests. `TestDefinition.java` is generated from this definition. | ||
| * `src/main/resources/com/google/cloud/conformance/firestore/v1/*.json` | ||
| * Each files is a json serialized `TestFile` definition (defined in tests.proto). |
1 change: 1 addition & 0 deletions
1
google-cloud-testing/google-cloud-conformance-tests/conformance-tests
Submodule conformance-tests
added at
32fd66
15 changes: 15 additions & 0 deletions
15
google-cloud-testing/google-cloud-conformance-tests/copyright-header.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* | ||
| * Copyright 2019 Google LLC | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * 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. | ||
| */ |
79 changes: 79 additions & 0 deletions
79
google-cloud-testing/google-cloud-conformance-tests/generate-conformance-tests.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| #!/bin/bash | ||
| # Copyright 2019 Google Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # 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. | ||
|
|
||
| set -o errexit -o errtrace -o nounset -o pipefail | ||
|
|
||
| function errNotify() { | ||
| echo "Error while generating conformance tests" >&2; | ||
| echo "See generate.log for details" >&2; | ||
| return 1 | ||
| } | ||
| trap errNotify ERR | ||
|
|
||
| function generateFirestore() { | ||
| rm generate.log 2> /dev/null || true | ||
|
|
||
| local javaPackage="com/google/cloud/conformance/firestore/v1" | ||
|
|
||
| msg "Cleaning existing generated protos" | ||
| rm -rf src/main/java/${javaPackage}/* | ||
| msg "Cleaning existing test definitions" | ||
| rm -rf src/main/resources/${javaPackage}/* | ||
| msg "Cleaning existing proto files" | ||
| rm -rf src/main/proto/google/cloud/conformance/firestore/v1/* | ||
|
|
||
| msg "Copying new proto files" | ||
| cp -R -t src/main/proto/ conformance-tests/firestore/v1/proto/* | ||
| msg "Copying new test definitions" | ||
| cp -R -t "src/main/resources/${javaPackage}/" conformance-tests/firestore/v1/*.json | ||
|
|
||
| msg "Generating protos" | ||
| mvn -Pgen-conformance-protos clean verify > generate.log 2>&1 | ||
|
|
||
| msg "Adding copyright header to generated sources" | ||
| ## java classes generated from protoc do not include the copyright header | ||
| ## prepend it to the generated files | ||
| local moduleDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
| pushd target/generated-sources/protobuf/java/${javaPackage} | ||
| for f in $(find ./ -type f -name '*.java'); do | ||
| echo "Processing $f" | ||
| mv ${f} ${f}.tmp | ||
| cat ${moduleDir}/copyright-header.txt > ${f} | ||
| cat ${f}.tmp >> ${f} | ||
| rm ${f}.tmp | ||
| done | ||
| popd | ||
|
|
||
| ## move generated proto class(es) into the main src root | ||
| cp -R -t src/main/java/${javaPackage} target/generated-sources/protobuf/java/${javaPackage}/* | ||
|
|
||
| ## cleanup any generated files that may have not been moved over | ||
| mvn clean > /dev/null 2>&1 | ||
|
|
||
| msg "Building module" | ||
| ## ensure building of the module still works | ||
| mvn clean package | ||
|
|
||
| } | ||
|
|
||
| function main() { | ||
| generateFirestore | ||
| } | ||
|
|
||
| function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} | ||
| function msg { println "$*" >&2 ;} | ||
| function println { printf '%s\n' "$(now) $*" ;} | ||
|
|
||
| main |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding, what does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is the definition for the git-submodule which is being used to track which revision the local conformance test resources came from. You can see an example of what it looks like and how it exists in the file tree here.