Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

928 ceilometer statistics date parsing #1049

Merged
merged 8 commits into from
Jul 4, 2017

Conversation

pdube
Copy link
Contributor

@pdube pdube commented Jun 22, 2017

Hi,

This is my first PR for openstack4j. The dates being parsed for the Statistics are not offset anymore by the microseconds as explained in #928. I am having problems running the core-tests though, each time, I am getting Tests are skipped. even when adding -Dmaven.test.skip=false

If someone could give me a hand that would be great

@pdube
Copy link
Contributor Author

pdube commented Jun 22, 2017

Also, what is the release cycle for OS4J?

@pdube
Copy link
Contributor Author

pdube commented Jun 27, 2017

@auhlig @gondor this is my first PR, so is there anything else I need to do?

@auhlig
Copy link
Member

auhlig commented Jun 27, 2017

Ah. Sorry for the delay. Too busy. I'll take a look tomorrow morning. sets a reminder

@pdube
Copy link
Contributor Author

pdube commented Jun 27, 2017

No problem, I was just wondering if anyone had seen it, or what the procedure was :) Thanks for checking it out

Copy link
Member

@auhlig auhlig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite the comments this looks good @pdube

private Date periodEnd;

private Double sum;

private String unit;

private String groupby;
@JsonProperty("groupby")
private Map<String, Object> groupBy;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it justMap<String, String>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually didn't work with the second type as a String. It was just ignored by Jackson. This field is actually a bit confusing, it looks like:

{"project_id":"some_id"}

It itsn't necessary for this PR so I think I will revert the change.

@@ -13,19 +19,25 @@
* @author Jeremy Unruh
*/
public class CeilometerStatistics implements Statistics {

private static final Logger LOG = LoggerFactory.getLogger(CeilometerStatistics.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation alternating between spaces and tabs. Could you reformat this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

@@ -34,17 +46,22 @@

private Integer period;

@JsonProperty("period_start")
@JsonProperty("period_start")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would

@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS")
@JsonProperty("period_start")
private Date durationStart;

instead of adding a new property work?
Then you could also revert the changes made to the getDurationStart() and getDurationEnd().

Please add a test for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, didn't know that existed. Will test

@auhlig auhlig added this to the 3.1.0 Release milestone Jun 28, 2017
@auhlig
Copy link
Member

auhlig commented Jun 28, 2017

At least the pipeline runs the tests.
We're cutting a new release once enough changes piled up.

@pdube
Copy link
Contributor Author

pdube commented Jun 28, 2017

@auhlig I checked out the pipeline, and the tests from core-test are not being run.

Building OpenStack4j Test Cases 3.0.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/mockwebserver/3.2.0/mockwebserver-3.2.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/mockwebserver/3.2.0/mockwebserver-3.2.0.pom (3 KB at 11.3 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/parent/3.2.0/parent-3.2.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/parent/3.2.0/parent-3.2.0.pom (10 KB at 144.5 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/3.2.0/okhttp-3.2.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/3.2.0/okhttp-3.2.0.pom (2 KB at 60.1 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.pom (2 KB at 37.0 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okio/okio-parent/1.6.0/okio-parent-1.6.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okio/okio-parent/1.6.0/okio-parent-1.6.0.pom (4 KB at 173.2 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp-ws/3.2.0/okhttp-ws-3.2.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp-ws/3.2.0/okhttp-ws-3.2.0.pom (2 KB at 25.0 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.50/bcprov-jdk15on-1.50.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.50/bcprov-jdk15on-1.50.pom (2 KB at 112.7 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/mockito/mockito-core/1.9.0/mockito-core-1.9.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/mockito/mockito-core/1.9.0/mockito-core-1.9.0.pom (2 KB at 77.0 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.pom (481 B at 18.1 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1.pom (6 KB at 318.8 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/objenesis/objenesis/1.0/objenesis-1.0.pom
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/objenesis/objenesis/1.0/objenesis-1.0.pom (853 B at 92.6 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/mockwebserver/3.2.0/mockwebserver-3.2.0.jar
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/3.2.0/okhttp-3.2.0.jar
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.jar
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp-ws/3.2.0/okhttp-ws-3.2.0.jar
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.50/bcprov-jdk15on-1.50.jar
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/mockwebserver/3.2.0/mockwebserver-3.2.0.jar (45 KB at 1834.1 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/mockito/mockito-core/1.9.0/mockito-core-1.9.0.jar
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okio/okio/1.6.0/okio-1.6.0.jar (65 KB at 2476.3 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp-ws/3.2.0/okhttp-ws-3.2.0.jar (26 KB at 945.5 KB/sec)
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/objenesis/objenesis/1.0/objenesis-1.0.jar
[INFO] Downloaded: http://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/3.2.0/okhttp-3.2.0.jar (328 KB at 8855.3 KB/sec)
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/objenesis/objenesis/1.0/objenesis-1.0.jar (28 KB at 547.0 KB/sec)
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar (75 KB at 1134.0 KB/sec)
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/mockito/mockito-core/1.9.0/mockito-core-1.9.0.jar (1382 KB at 19180.8 KB/sec)
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.50/bcprov-jdk15on-1.50.jar (2669 KB at 11453.4 KB/sec)
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ openstack4j-core-test ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ openstack4j-core-test ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ openstack4j-core-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 323 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ openstack4j-core-test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 126 source files to /home/travis/build/ContainX/openstack4j/core-test/target/classes
[WARNING] /home/travis/build/ContainX/openstack4j/core-test/src/main/java/org/openstack4j/api/murano/v1/ServicesTests.java: /home/travis/build/ContainX/openstack4j/core-test/src/main/java/org/openstack4j/api/murano/v1/ServicesTests.java uses unchecked or unsafe operations.
[WARNING] /home/travis/build/ContainX/openstack4j/core-test/src/main/java/org/openstack4j/api/murano/v1/ServicesTests.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ openstack4j-core-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/travis/build/ContainX/openstack4j/core-test/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ openstack4j-core-test ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ openstack4j-core-test ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ openstack4j-core-test ---
[INFO] Building jar: /home/travis/build/ContainX/openstack4j/core-test/target/openstack4j-core-test-2.0.0.jar
[INFO] 
[INFO] --- maven-source-plugin:2.2.1:jar-no-fork (attach-sources) @ openstack4j-core-test ---
[INFO] Building jar: /home/travis/build/ContainX/openstack4j/core-test/target/openstack4j-sources.jar

@pdube
Copy link
Contributor Author

pdube commented Jun 28, 2017

There is

	<properties>
		<skipTests>true</skipTests>
	</properties>

In the pom.xml of core-test

@auhlig
Copy link
Member

auhlig commented Jun 28, 2017

They are executed for each connector. Scroll further. Then you the the logs from the tests.
Go to the project's root folder and run mvn clean verify to run both unit and integration tests.

@pdube
Copy link
Contributor Author

pdube commented Jun 28, 2017

Ok, so if I create a test for this, in which project should it be created? In core?

@auhlig
Copy link
Member

auhlig commented Jun 28, 2017

The unit tests can be found under the respective service-folder in the core-tests module.

@pdube
Copy link
Contributor Author

pdube commented Jun 28, 2017

I reverted the groupby changes as they were not related to the bug I was referencing. I also pushed a couple unit tests. I also moved the parsing code into a Deserializer, so it could be reused in other telemetry code. The other Sample classes are skirting around the problem because they don't serialize directly to a Date. Thanks for the review

@auhlig auhlig closed this Jun 30, 2017
@auhlig auhlig reopened this Jun 30, 2017
@auhlig
Copy link
Member

auhlig commented Jun 30, 2017

Sorry. Was about to review but hit close accidentally.

@auhlig auhlig merged commit 6be877b into ContainX:master Jul 4, 2017
@pdube
Copy link
Contributor Author

pdube commented Jul 4, 2017

Awesome. Thanks :)

@auhlig
Copy link
Member

auhlig commented Jul 4, 2017

Thanks for contributing @pdube :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants