You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "keith-turner (via GitHub)" <gi...@apache.org> on 2023/09/27 22:54:21 UTC

[GitHub] [accumulo] keith-turner opened a new pull request, #3785: fixes multiple tests in ShellServerIT

keith-turner opened a new pull request, #3785:
URL: https://github.com/apache/accumulo/pull/3785

   Multiple tests in ShellServerIT only ran when their table id was 1 or 2. This commit updates the test to run with any table id.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fixes multiple tests in ShellServerIT [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner merged PR #3785:
URL: https://github.com/apache/accumulo/pull/3785


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3785: fixes multiple tests in ShellServerIT

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3785:
URL: https://github.com/apache/accumulo/pull/3785#discussion_r1341843532


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -1321,51 +1315,61 @@ public void testGetGoalCommand() throws IOException, TableNotFoundException {
 
   // Verify that when splits are added after table creation, hosting goals are set properly
   @Test
-  public void testGetGoalCommand_DelayedSplits() throws IOException {
+  public void testGetGoalCommand_DelayedSplits() throws Exception {
+
+    for (int i = 0; i < 40; i++) {
+      ts.exec("createtable tab" + i, true);
+    }
 
     final String[] tableName = getUniqueNames(2);
 
     ts.exec("createtable " + tableName[0], true);
+
+    String tableId = getTableId(tableName[0]);
+
     String result = ts.exec("getgoal");
+
     assertTrue(result.contains("TABLE: " + tableName[0]));
     assertTrue(result.contains("TABLET ID    HOSTING GOAL"));
-    assertTrue(result.contains("1<<          ONDEMAND"));
+    assertTrue(result.matches("(?s).*" + tableId + "<<\\s+ONDEMAND.*"));

Review Comment:
   The reason I did pattern matching was because the number of spaces in the output would change when the length of the table id changed.  So for a one character table id would see more spaces in the output than if there was a two digit table id.
   
   As for checking the order, that could be a follow on issue.  It would make the test more strict.  The test was not checking the order before these changes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3785: fixes multiple tests in ShellServerIT

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3785:
URL: https://github.com/apache/accumulo/pull/3785#discussion_r1341843905


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -1841,8 +1845,8 @@ public void scansWithNeverHostedTablets() throws Exception {
     final String table = getUniqueNames(1)[0];
     ts.exec("createtable " + table);
     ts.exec("addsplits -t " + table + " a c e g m t");
-    ts.exec("goal -t " + table + " -b a -e a -g never");
-    ts.exec("goal -t " + table + " -b c -e e -ee -g always");
+    ts.exec("setgoal -t " + table + " -b a -e a -g never");

Review Comment:
   @ctubbsii  the name of that command is out of scope for this PR, but what are you wrote sounds reasonable.  Can you open an issue for reconsidering the name?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3785: fixes multiple tests in ShellServerIT

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #3785:
URL: https://github.com/apache/accumulo/pull/3785#discussion_r1339523228


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -1841,8 +1845,8 @@ public void scansWithNeverHostedTablets() throws Exception {
     final String table = getUniqueNames(1)[0];
     ts.exec("createtable " + table);
     ts.exec("addsplits -t " + table + " a c e g m t");
-    ts.exec("goal -t " + table + " -b a -e a -g never");
-    ts.exec("goal -t " + table + " -b c -e e -ee -g always");
+    ts.exec("setgoal -t " + table + " -b a -e a -g never");

Review Comment:
   Elsewhere, we call this "hosting goal", so "sethostinggoal" would be appropriate as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fixes multiple tests in ShellServerIT [accumulo]

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3785:
URL: https://github.com/apache/accumulo/pull/3785#discussion_r1342790658


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -1841,8 +1845,8 @@ public void scansWithNeverHostedTablets() throws Exception {
     final String table = getUniqueNames(1)[0];
     ts.exec("createtable " + table);
     ts.exec("addsplits -t " + table + " a c e g m t");
-    ts.exec("goal -t " + table + " -b a -e a -g never");
-    ts.exec("goal -t " + table + " -b c -e e -ee -g always");
+    ts.exec("setgoal -t " + table + " -b a -e a -g never");

Review Comment:
   Opened #3800 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] keith-turner commented on a diff in pull request #3785: fixes multiple tests in ShellServerIT

Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #3785:
URL: https://github.com/apache/accumulo/pull/3785#discussion_r1341843905


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -1841,8 +1845,8 @@ public void scansWithNeverHostedTablets() throws Exception {
     final String table = getUniqueNames(1)[0];
     ts.exec("createtable " + table);
     ts.exec("addsplits -t " + table + " a c e g m t");
-    ts.exec("goal -t " + table + " -b a -e a -g never");
-    ts.exec("goal -t " + table + " -b c -e e -ee -g always");
+    ts.exec("setgoal -t " + table + " -b a -e a -g never");

Review Comment:
   @ctubbsii  the name of that command is out of scope for this PR, but what you wrote sounds reasonable.  Can you open an issue for reconsidering the name?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3785: fixes multiple tests in ShellServerIT

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #3785:
URL: https://github.com/apache/accumulo/pull/3785#discussion_r1339509741


##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -1841,8 +1845,8 @@ public void scansWithNeverHostedTablets() throws Exception {
     final String table = getUniqueNames(1)[0];
     ts.exec("createtable " + table);
     ts.exec("addsplits -t " + table + " a c e g m t");
-    ts.exec("goal -t " + table + " -b a -e a -g never");
-    ts.exec("goal -t " + table + " -b c -e e -ee -g always");
+    ts.exec("setgoal -t " + table + " -b a -e a -g never");

Review Comment:
   I think `setgoal` is not a very good name for a tablet-specific function, as it makes one wonder "goal for what?", because "goal" is too generic of a term.
   
   I think "hosttablet ... always/never/ondemand" or "settabletgoal ... always/never/ondemand". Even these are probably not the best names either, but they give a lot more context to what kind of goal is being set.
   
   Alternatively, one could have a command named "tablet" and a sub-command called something like "online", so you get a very expressive command like: "tablet online... always/never/ondemand" or maybe "tablet hosted... always/never/ondemand".
   
   Or we could overload the current `online` command to be able to set a range, and an optional flag for `ondemand`. So, you get the following:
   
   ```sh
   > online -t table -b beginRange -e endRange             # "always"
   > offline -t table -b beginRange -e endRange            # "never"
   > online -t table -b beginRange -e endRange --ondemand  # "ondemand"
   ```
   



##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -2318,7 +2333,7 @@ public void testListTablets() throws IOException, InterruptedException {
       if (tokens[1].startsWith("file")) {
         String[] parts = tokens[1].split("/");
         String dir = parts[parts.length - 2];
-        assertTrue(results.contains(dir));
+        assertTrue(results.contains(dir), " Did not see " + dir);

Review Comment:
   ```suggestion
           assertTrue(results.contains(dir), "Did not see " + dir);
   ```



##########
test/src/main/java/org/apache/accumulo/test/shell/ShellServerIT.java:
##########
@@ -1321,51 +1315,61 @@ public void testGetGoalCommand() throws IOException, TableNotFoundException {
 
   // Verify that when splits are added after table creation, hosting goals are set properly
   @Test
-  public void testGetGoalCommand_DelayedSplits() throws IOException {
+  public void testGetGoalCommand_DelayedSplits() throws Exception {
+
+    for (int i = 0; i < 40; i++) {
+      ts.exec("createtable tab" + i, true);
+    }
 
     final String[] tableName = getUniqueNames(2);
 
     ts.exec("createtable " + tableName[0], true);
+
+    String tableId = getTableId(tableName[0]);
+
     String result = ts.exec("getgoal");
+
     assertTrue(result.contains("TABLE: " + tableName[0]));
     assertTrue(result.contains("TABLET ID    HOSTING GOAL"));
-    assertTrue(result.contains("1<<          ONDEMAND"));
+    assertTrue(result.matches("(?s).*" + tableId + "<<\\s+ONDEMAND.*"));

Review Comment:
   Are the lines in the output coming in an unpredictable order? Is there a reason why we're doing pattern matching anywhere in the multi-line string result for the lines we expect, instead of just iterating over the lines and checking to verify each line contains the next thing we expect?
   
   Something like:
   
   ```java
       Iterator<String> iter = splitLines(result);
       line = iter.next(); assertTrue(line.contains(firstLineCondition));
       line = iter.next(); assertTrue(line.contains(nextLineCondition));
       line = iter.next(); assertTrue(line.contains(nextLineCondition));
       // ...
       assertFalse(iter.hasNext());
   ```
   
   This seems simpler to read and maintain than a bunch of regexes that don't verify that the output is appearing in the expected order.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org