Skip to content

Commit 4917778

Browse files
committed
Fixed broken tests.
1 parent cebbd3b commit 4917778

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/test/java/com/joyent/hadoop/fs/manta/MantaConfigTest.java

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

33
import org.apache.hadoop.conf.Configuration;
44
import org.apache.hadoop.fs.FileSystem;
5+
import org.junit.AfterClass;
56
import org.junit.Test;
67

78
import java.io.IOException;
@@ -10,6 +11,11 @@
1011
import static org.junit.Assert.assertTrue;
1112

1213
public class MantaConfigTest {
14+
@AfterClass
15+
public static void cleanUp() throws IOException {
16+
FileSystem.closeAll();
17+
}
18+
1319
@Test
1420
public void hadoopCanLoadFilesystemFromServiceLoader() throws IOException {
1521
final Configuration config = new Configuration();

src/test/java/com/joyent/hadoop/fs/manta/MantaFileSystemIT.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.joyent.manta.client.MantaObject;
66
import com.joyent.manta.config.ConfigContext;
77
import com.joyent.manta.exception.MantaClientHttpResponseException;
8+
import com.joyent.manta.exception.MantaErrorCode;
89
import org.apache.commons.codec.digest.DigestUtils;
910
import org.apache.commons.io.Charsets;
1011
import org.apache.commons.io.FileUtils;
@@ -42,6 +43,7 @@
4243
import static org.junit.Assert.assertEquals;
4344
import static org.junit.Assert.assertFalse;
4445
import static org.junit.Assert.assertTrue;
46+
import static org.junit.Assert.fail;
4547
import static org.mockito.Mockito.mock;
4648
import static org.mockito.internal.verification.VerificationModeFactory.atLeast;
4749

@@ -66,9 +68,9 @@ public static void setup() throws IOException {
6668
try {
6769
client.putDirectory(basePath);
6870
} catch (MantaClientHttpResponseException e) {
69-
if (e.getStatusCode() == 403) {
71+
if (e.getServerCode().equals(MantaErrorCode.ACCOUNT_BLOCKED_ERROR)) {
7072
throw new IOException("You must have Manta credentials setup to "
71-
+ "run the integration test suite");
73+
+ "run the integration test suite", e);
7274
}
7375
}
7476
}
@@ -82,7 +84,7 @@ public static void cleanup() throws IOException {
8284
}
8385
} finally {
8486
config = null;
85-
fs.close();
87+
FileSystem.closeAll();
8688
}
8789
}
8890

@@ -99,7 +101,10 @@ private static MantaFileSystem instance() {
99101

100102
try {
101103
FileSystem fs = FileSystem.get(uri, config);
102-
@SuppressWarnings("unchecked")
104+
105+
if (!(fs instanceof MantaFileSystem)) {
106+
fail("FileSystem should be an instance of MantaFileSystem");
107+
}
103108
MantaFileSystem mfs = (MantaFileSystem)fs;
104109

105110
return mfs;

0 commit comments

Comments
 (0)