TEST fix the alert serialization test to look at each field instead of compairing alerts directly.

Original commit: elastic/x-pack-elasticsearch@2d0d4ce6df
This commit is contained in:
Brian Murphy 2014-11-18 15:46:17 +00:00
parent 6e7ea3cc5b
commit 7d27fdfc4b
1 changed files with 10 additions and 5 deletions

View File

@ -13,7 +13,6 @@ import org.elasticsearch.common.joda.time.DateTime;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.junit.Test;
@ -47,10 +46,16 @@ public class AlertSerializationTest extends ElasticsearchIntegrationTest {
internalCluster().getInstance(AlertsStore.class, internalCluster().getMasterName());
Alert parsedAlert = alertsStore.parseAlert("test-serialization", jsonBuilder.bytes());
assertEquals(parsedAlert, alert);
logger.error(XContentHelper.convertToJson(jsonBuilder.bytes(),false,true));
assertEquals(parsedAlert.enabled(), alert.enabled());
assertEquals(parsedAlert.version(), alert.version());
assertEquals(parsedAlert.actions(), alert.actions());
assertEquals(parsedAlert.lastActionFire().getMillis(), alert.lastActionFire().getMillis());
assertEquals(parsedAlert.schedule(), alert.schedule());
assertEquals(parsedAlert.getSearchRequest().source(), alert.getSearchRequest().source());
assertEquals(parsedAlert.trigger(), alert.trigger());
}
}