A couple tests in ShardTransactionTest are failing on jenkins builds:
java.lang.AssertionError: assertion failed: expected class
org.opendaylight.controller.protobuff.messages.cohort3pc.ThreePhaseCommitCohortMessages$CommitTransactionReply,
found class akka.actor.Status$Failure
at scala.Predef$.assert(Predef.scala:179)
at
akka.testkit.TestKitBase$class.expectMsgClass_internal(TestKit.scala:424)
at
akka.testkit.TestKitBase$class.expectMsgClass(TestKit.scala:419)
at akka.testkit.TestKit.expectMsgClass(TestKit.scala:718)
at akka.testkit.JavaTestKit.expectMsgClass(JavaTestKit.java:408)
at
org.opendaylight.controller.cluster.datastore.ShardTransactionTest$14.<init>(ShardTransactionTest.java:474)
at
org.opendaylight.controller.cluster.datastore.ShardTransactionTest.testOnReceiveBatchedModificationsReadyWithImmediateCommit(ShardTransactionTest.java:454)
The tests use a "desc" leaf node but it's not defined in the test yang.
Nothing has changed in these tests so it appears there was a recent change
in yangtools to validate the node structure on put/merge.
I also fixed an intermittent timing failure in
PreLithiumShardTest#testHelium2VersionApplyStateLegacy that I see a
couple times.
Also, JsonToNnTest has been failing on merge builds:
org.junit.ComparisonFailure: expected:<...me cont wasn't found[].> but
was:<...me cont wasn't found[ under
(urn:ietf:params:xml:ns:netconf:base:1.0)data].>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at
org.opendaylight.controller.sal.restconf.impl.json.to.nn.test.JsonToNnTest.incorrectTopLevelElementsTest(JsonToNnTest.java:129)
Apparently a change elsewhere added more text to the error message. I
changed the test to use the containsString matcher instead of exact
match.
Change-Id: I33ef71bce50ff39e26dcf2b443679c8eb34dd0dd
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
@Test
public void testHelium2VersionApplyStateLegacy() throws Exception {
@Test
public void testHelium2VersionApplyStateLegacy() throws Exception {
+ new ShardTestKit(getSystem()) {{
+ TestActorRef<Shard> shard = TestActorRef.create(getSystem(), newShardProps(),
+ "testHelium2VersionApplyStateLegacy");
- TestActorRef<Shard> shard = TestActorRef.create(getSystem(), newShardProps(), "testHelium2VersionApplyStateLegacy");
+ waitUntilLeader(shard);
- NormalizedNode<?, ?> node = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+ NormalizedNode<?, ?> node = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
- ApplyState applyState = new ApplyState(null, "test", new ReplicatedLogImplEntry(1, 2,
- newLegacyByteStringPayload(new WriteModification(TestModel.TEST_PATH, node))));
+ ApplyState applyState = new ApplyState(null, "test", new ReplicatedLogImplEntry(1, 2,
+ newLegacyByteStringPayload(new WriteModification(TestModel.TEST_PATH, node))));
- shard.underlyingActor().onReceiveCommand(applyState);
+ shard.underlyingActor().onReceiveCommand(applyState);
- NormalizedNode<?,?> actual = readStore(shard, TestModel.TEST_PATH);
- assertEquals("Applied state", node, actual);
+ NormalizedNode<?,?> actual = readStore(shard, TestModel.TEST_PATH);
+ assertEquals("Applied state", node, actual);
- shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
+ shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
+ }};
public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
- public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
+ leaf name {
+ type string;
+ }
+
+ leaf desc {
+ type string;
+ }
+
list outer-list {
key id;
leaf id {
list outer-list {
key id;
leaf id {
*/
package org.opendaylight.controller.sal.restconf.impl.json.to.nn.test;
*/
package org.opendaylight.controller.sal.restconf.impl.json.to.nn.test;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import org.junit.Test;
import org.opendaylight.controller.sal.rest.impl.JsonNormalizedNodeBodyReader;
import org.opendaylight.controller.sal.rest.impl.test.providers.AbstractBodyReaderTest;
import org.junit.Test;
import org.opendaylight.controller.sal.rest.impl.JsonNormalizedNodeBodyReader;
import org.opendaylight.controller.sal.rest.impl.test.providers.AbstractBodyReaderTest;
countExceptions++;
}
assertNotNull(exception);
countExceptions++;
}
assertNotNull(exception);
- assertEquals(
- "Error parsing input: Schema node with name cont wasn't found.",
- exception.getErrors().get(0).getErrorMessage());
+ assertThat(exception.getErrors().get(0).getErrorMessage(),
+ containsString("Error parsing input: Schema node with name cont wasn't found"));
inputStream = this.getClass().getResourceAsStream(
"/json-to-nn/wrong-top-level2.json");
inputStream = this.getClass().getResourceAsStream(
"/json-to-nn/wrong-top-level2.json");
countExceptions++;
}
assertNotNull(exception);
countExceptions++;
}
assertNotNull(exception);
- assertEquals(
- "Error parsing input: Schema node with name lst1 wasn't found.",
- exception.getErrors().get(0).getErrorMessage());
+ assertThat(exception.getErrors().get(0).getErrorMessage(),
+ containsString("Error parsing input: Schema node with name lst1 wasn't found"));
inputStream = this.getClass().getResourceAsStream(
"/json-to-nn/wrong-top-level3.json");
inputStream = this.getClass().getResourceAsStream(
"/json-to-nn/wrong-top-level3.json");
countExceptions++;
}
assertNotNull(exception);
countExceptions++;
}
assertNotNull(exception);
- assertEquals(
- "Error parsing input: Schema node with name lf wasn't found.",
- exception.getErrors().get(0).getErrorMessage());
+ assertThat(exception.getErrors().get(0).getErrorMessage(),
+ containsString("Error parsing input: Schema node with name lf wasn't found"));
assertEquals(3, countExceptions);
}
assertEquals(3, countExceptions);
}