diff options
author | Jon Bratseth <bratseth@gmail.com> | 2023-01-22 14:34:57 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2023-01-22 14:34:57 +0100 |
commit | 1d5806f068309e18b70fee03b7a22e111c180607 (patch) | |
tree | 83eddc958301445e5d9b13ea602f963a39a7f5e2 /config-model/src/test/java/com/yahoo/vespa/model | |
parent | 1f2865c97efe67f6f54151c26990226063c85d26 (diff) |
Improve error messages
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model')
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java | 9 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java | 7 |
2 files changed, 10 insertions, 6 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java index 07c032a52a5..7fba5ba12e9 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java @@ -6,6 +6,7 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.search.DispatchGroup; import com.yahoo.vespa.model.search.SearchInterface; import com.yahoo.vespa.model.search.SearchNode; +import com.yahoo.yolean.Exceptions; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -176,7 +177,8 @@ public class IndexedHierarchicDistributionTest { getIllegalMultipleGroupsLevelCluster(); fail("Did not get expected Exception"); } catch (Exception e) { - assertTrue(e.getMessage().contains("sub group 'group0' contains 2 sub groups.")); + assertEquals("Expected all groups under root group 'null' to be leaf groups only containing nodes, but sub group 'group0' contains 2 sub groups", + Exceptions.toMessageString(e)); } } @@ -220,7 +222,8 @@ public class IndexedHierarchicDistributionTest { getTwoGroupsCluster(3, 3, "2|*"); fail("Did not get expected Exception"); } catch (Exception e) { - assertTrue(e.getMessage().contains("Expected number of leaf groups (2) to be a factor of redundancy (3)")); + assertEquals("In content cluster 'mycluster': Expected number of leaf groups (2) to be a factor of redundancy (3), but it is not", + Exceptions.toMessageString(e)); } } @@ -240,7 +243,7 @@ public class IndexedHierarchicDistributionTest { getTwoGroupsCluster(4, 3, "2|*"); fail("Did not get expected Exception"); } catch (Exception e) { - assertTrue(e.getMessage().contains("Expected equal amount of ready copies per group")); + assertEquals("In content cluster 'mycluster': Expected equal amount of ready copies per group, but 3 ready copies is specified with 2 groups", Exceptions.toMessageString(e)); } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java index 9fb4eefba75..57ee15a1dc4 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java @@ -21,6 +21,7 @@ import static com.yahoo.config.model.test.TestUtil.joinLines; import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.content.storagecluster.StorageCluster; import com.yahoo.vespa.model.content.utils.ContentClusterUtils; +import com.yahoo.yolean.Exceptions; import org.junit.jupiter.api.Test; @@ -432,8 +433,8 @@ public class StorageClusterTest { ContentClusterUtils.createCluster(xml, root); fail("Did not fail when having both group and nodes"); } catch (RuntimeException e) { - assertEquals("Both <group> and <nodes> is specified: Only one of these tags can be used in the same configuration", - e.getMessage()); + assertEquals("In content cluster 'storage': Both <group> and <nodes> is specified: Only one of these tags can be used in the same configuration", + Exceptions.toMessageString(e)); } } @@ -507,7 +508,7 @@ public class StorageClusterTest { ContentClusterUtils.createCluster(xml, new MockRoot()); fail("Did not get exception with missing distribution element"); } catch (RuntimeException e) { - assertEquals("'distribution' attribute is required with multiple subgroups", e.getMessage()); + assertEquals("In content cluster 'storage': 'distribution' attribute is required with multiple subgroups", Exceptions.toMessageString(e)); } } } |