This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 20209e7  Add upgrade unit test
20209e7 is described below

commit 20209e7a9f5571831704301a79368b08f4f2ab9d
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Thu Oct 31 10:26:07 2019 -0400

    Add upgrade unit test
    
    This file was supposed to go with #1389 but I forgot to add it.
---
 .../accumulo/master/upgrade/Upgrader9to10Test.java | 64 ++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git 
a/server/master/src/test/java/org/apache/accumulo/master/upgrade/Upgrader9to10Test.java
 
b/server/master/src/test/java/org/apache/accumulo/master/upgrade/Upgrader9to10Test.java
new file mode 100644
index 0000000..b5ba3ec
--- /dev/null
+++ 
b/server/master/src/test/java/org/apache/accumulo/master/upgrade/Upgrader9to10Test.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.accumulo.master.upgrade;
+
+import static org.apache.accumulo.core.Constants.BULK_PREFIX;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.server.gc.GcVolumeUtil;
+import org.junit.Test;
+
+public class Upgrader9to10Test {
+  @Test
+  public void testSwitchRelative() {
+    assertEquals(GcVolumeUtil.getDeleteTabletOnAllVolumesUri(TableId.of("5a"), 
"t-0005"),
+        Upgrader9to10.switchToAllVolumes("/5a/t-0005"));
+    assertEquals("/5a/" + BULK_PREFIX + "0005",
+        Upgrader9to10.switchToAllVolumes("/5a/" + BULK_PREFIX + "0005"));
+    assertEquals("/5a/t-0005/F0009.rf", 
Upgrader9to10.switchToAllVolumes("/5a/t-0005/F0009.rf"));
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void testBadRelativeTooShort() {
+    Upgrader9to10.switchToAllVolumes("/5a");
+  }
+
+  @Test(expected = IllegalStateException.class)
+  public void testBadRelativeTooLong() {
+    Upgrader9to10.switchToAllVolumes("/5a/5a/t-0005/F0009.rf");
+  }
+
+  @Test
+  public void testSwitch() {
+    assertEquals(GcVolumeUtil.getDeleteTabletOnAllVolumesUri(TableId.of("5a"), 
"t-0005"),
+        
Upgrader9to10.switchToAllVolumes("hdfs://localhost:9000/accumulo/tables/5a/t-0005"));
+    assertEquals("hdfs://localhost:9000/accumulo/tables/5a/" + BULK_PREFIX + 
"0005", Upgrader9to10
+        .switchToAllVolumes("hdfs://localhost:9000/accumulo/tables/5a/" + 
BULK_PREFIX + "0005"));
+    assertEquals("hdfs://localhost:9000/accumulo/tables/5a/t-0005/C0009.rf", 
Upgrader9to10
+        
.switchToAllVolumes("hdfs://localhost:9000/accumulo/tables/5a/t-0005/C0009.rf"));
+  }
+
+  @Test
+  public void testUpgradeDir() {
+    assertEquals("t-0005",
+        
Upgrader9to10.upgradeDirColumn("hdfs://localhost:9000/accumulo/tables/5a/t-0005"));
+    assertEquals("t-0005", Upgrader9to10.upgradeDirColumn("../5a/t-0005"));
+    assertEquals("t-0005", Upgrader9to10.upgradeDirColumn("/t-0005"));
+    assertEquals("t-0005", Upgrader9to10.upgradeDirColumn("t-0005"));
+  }
+}

Reply via email to