fix flaky tests (#6905)

Co-authored-by: Yanni <yz97@illinois.edu>
This commit is contained in:
yannizhou05 2022-11-30 01:53:11 -06:00 committed by GitHub
parent adec811052
commit 94fd03df13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import junit.framework.Assert;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.junit.Test;
import com.google.gson.JsonParser;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -58,7 +59,8 @@ public class NeutronNetworkAdapterTest {
entity = new StringRequestEntity(gsonNeutronNetwork.toJson(networkWrapper), "application/json", null);
String actual = entity.getContent();
Assert.assertEquals(jsonString, actual);
JsonParser parser = new JsonParser();
Assert.assertEquals(parser.parse(jsonString), parser.parse(actual));
} catch (UnsupportedEncodingException e) {
Assert.fail(e.getMessage());
}

View File

@ -29,6 +29,7 @@ import org.apache.cloudstack.network.opendaylight.api.model.NeutronNodeWrapper;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.junit.Test;
import com.google.gson.JsonParser;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -48,7 +49,8 @@ public class NeutronNodeAdapterTest {
entity = new StringRequestEntity(gsonNeutronNode.toJson(nodeWrapper), "application/json", null);
String actual = entity.getContent();
Assert.assertEquals(jsonString, actual);
JsonParser parser = new JsonParser();
Assert.assertEquals(parser.parse(jsonString), parser.parse(actual));
} catch (UnsupportedEncodingException e) {
Assert.fail(e.getMessage());
}

View File

@ -30,6 +30,7 @@ import org.apache.cloudstack.network.opendaylight.api.model.NeutronPortWrapper;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.junit.Test;
import com.google.gson.JsonParser;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@ -61,7 +62,8 @@ public class NeutronPortAdapterTest {
String actual = entity.getContent();
Assert.assertEquals(jsonString, actual);
JsonParser parser = new JsonParser();
Assert.assertEquals(parser.parse(jsonString), parser.parse(actual));
} catch (UnsupportedEncodingException e) {
Assert.fail(e.getMessage());
}