Skip to content

Commit 115a0e3

Browse files
arunkumarchackocnauroth
authored andcommitted
HADOOP-19343: Add instruction for running tests
Closes #7734 Signed-off-by: Chris Nauroth <cnauroth@apache.org>
1 parent 0b104fd commit 115a0e3

File tree

3 files changed

+91
-7
lines changed

3 files changed

+91
-7
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
```

hadoop-tools/hadoop-gcp/src/test/java/org/apache/hadoop/fs/gs/contract/GoogleContract.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
package org.apache.hadoop.fs.gs.contract;
2020

21-
import org.apache.hadoop.fs.gs.TestConfiguration;
2221
import org.apache.hadoop.conf.Configuration;
2322
import org.apache.hadoop.fs.contract.AbstractBondedFSContract;
2423

@@ -29,12 +28,6 @@ public class GoogleContract extends AbstractBondedFSContract {
2928
public GoogleContract(Configuration conf) {
3029
super(conf);
3130
addConfResource(CONTRACT_XML);
32-
conf.set("fs.contract.test.fs.gs", "gs://arunchacko-oss-test-bucket"); // TODO:
33-
34-
TestConfiguration testConf = TestConfiguration.getInstance();
35-
if (testConf.getProjectId() != null) {
36-
conf.set("fs.gs.project.id", testConf.getProjectId());
37-
}
3831
}
3932

4033
@Override
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
~ Licensed to the Apache Software Foundation (ASF) under one
3+
~ or more contributor license agreements. See the NOTICE file
4+
~ distributed with this work for additional information
5+
~ regarding copyright ownership. The ASF licenses this file
6+
~ to you under the Apache License, Version 2.0 (the
7+
~ "License"); you may not use this file except in compliance
8+
~ with the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<configuration>
20+
21+
</configuration>

0 commit comments

Comments
 (0)