| 
 | 1 | +<!---  | 
 | 2 | +  Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 3 | +  you may not use this file except in compliance with the License.  | 
 | 4 | +  You may obtain a copy of the License at  | 
 | 5 | +
  | 
 | 6 | +   http://www.apache.org/licenses/LICENSE-2.0  | 
 | 7 | +
  | 
 | 8 | +  Unless required by applicable law or agreed to in writing, software  | 
 | 9 | +  distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 10 | +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 11 | +  See the License for the specific language governing permissions and  | 
 | 12 | +  limitations under the License. See accompanying LICENSE file.  | 
 | 13 | +-->  | 
 | 14 | + | 
 | 15 | +# Testing the GCS filesystem client and its features  | 
 | 16 | + | 
 | 17 | +<!-- MACRO{toc|fromDepth=0|toDepth=3} -->  | 
 | 18 | + | 
 | 19 | +This module includes both unit tests, which can run in isolation without  | 
 | 20 | +connecting to the GCS service, and integration tests, which require a working  | 
 | 21 | +connection to GCS to interact with a bucket.  Unit test suites follow the naming  | 
 | 22 | +convention `Test*.java`.  Integration tests follow the naming convention  | 
 | 23 | +`ITest*.java`.  | 
 | 24 | + | 
 | 25 | +## <a name="setting-up"></a> Setting up the tests  | 
 | 26 | + | 
 | 27 | +To integration test the GCS filesystem client, you need to provide  | 
 | 28 | +`auth-keys.xml` which passes in authentication details to the test runner.  | 
 | 29 | + | 
 | 30 | +It is a Hadoop XML configuration file, which must be placed into  | 
 | 31 | +`hadoop-tools/hadoop-gcp/src/test/resources`.  | 
 | 32 | + | 
 | 33 | +### File `core-site.xml`  | 
 | 34 | + | 
 | 35 | +This file pre-exists and sources the configurations created  | 
 | 36 | +under `auth-keys.xml`.  | 
 | 37 | + | 
 | 38 | +For most purposes you will not need to edit this file unless you  | 
 | 39 | +need to apply a specific, non-default property change during the tests.  | 
 | 40 | + | 
 | 41 | +### File `auth-keys.xml`  | 
 | 42 | + | 
 | 43 | +The presence of this file triggers the testing of the GCS classes.  | 
 | 44 | + | 
 | 45 | +Without this file, *none of the integration tests in this module will be  | 
 | 46 | +executed*.  | 
 | 47 | + | 
 | 48 | +* `fs.contract.test.fs.gs` : the URL of the bucket for GCS filesystem contract tests  | 
 | 49 | + | 
 | 50 | +Example:  | 
 | 51 | + | 
 | 52 | +```xml  | 
 | 53 | +<configuration>  | 
 | 54 | +  <property>  | 
 | 55 | +    <name>fs.contract.test.fs.gs</name>  | 
 | 56 | +    <value>gs://your bucket name</value>  | 
 | 57 | +  </property>  | 
 | 58 | + | 
 | 59 | +</configuration>  | 
 | 60 | +```  | 
 | 61 | + | 
 | 62 | +## <a name="running"></a> Running the Tests  | 
 | 63 | + | 
 | 64 | +After completing the configuration, execute the test run through Maven.  | 
 | 65 | + | 
 | 66 | +This has to be run from a GCP VM. This limitation will be removed later.  | 
 | 67 | + | 
 | 68 | +```bash  | 
 | 69 | +mvn clean verify  | 
 | 70 | +```  | 
0 commit comments