-
Notifications
You must be signed in to change notification settings - Fork 8
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
MIGENG-365 - End2end integration test #20
MIGENG-365 - End2end integration test #20
Conversation
Added Sonar + Jacoco execution
Added JUnit 5 and AssertJ to pom Aplied some clean-code suggestions
Added support for JUnit 5 on old maven versions Added constructors on model Fixed AnalyticsCalculatorTest test Added Sonar info to README
Added lombok file to add Generated annotation that will be avoided by JaCoCo Added sample file to test multipart Added test for the multipart Removed accessors/modifiers for cloudforms classes Cleaned CustomizedMultipartDataFormat
Renamed test methods
Renamed test methods
Moved back to JUnit 4 as Camel Test support doesnt support JUnit 5 yet
Added very simple test for direct:store
Added test for direct-upload with individual files and zip file
Added test for direct:insights route
minor change on xmlroutestest
# Conflicts: # lombok.config # pom.xml # src/test/java/org/jboss/xavier/integrations/route/XmlRoutesTest.java
added cloudforms export file
removed testing route
@jonathanvila Thanks for the last commit, I can see that the last build in Travis failed with the same error I've found locally: This is the Travis Log: Here is a screenshot from my local machine. I've tested locally and it seems the error appears when my Laptop is slow (When I don't have all the CPU resources available). I guess it is because the containers are taking too much time for starting and it causes the problem. I wonder if increasing the time from |
@jonathanvila I've tried to deploy your PR in CI and the pod is not able to start because Here is the log of CI: |
fixed not available minio.host prop on runtime
String typeString = "Virt Platform"; | ||
return typeString + (type?" + SmartState": ""); | ||
public Boolean getType() { | ||
return type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathanvila and @carlosthe19916 sorry, just for my benefit.
The old getType
method's implementation has changed: it returns a Boolean
and not the String
the UI was showing (highlighted in the above screenshot).
Is there, in this PR, a new method that return the same String
the old getType
method provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No , there is no method to return the string needed. The UI ticket is only going to show the text that comes from the report or it will convert the boolean to the String it was being sent ? When we said the UI was going to change because of this change I assumed it was because the UI would be in charge of that change. If it's the backend who has to send the string in the report , then that method is missing at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed a little bit more about this with @carlosthe19916 because to me having a boolean type
field was not clear what it referred to.
The previous String type
was providing the Type
label value to the shown in the UI (screenshot above) but now a boolean value is hard to understand what it refers to just calling it type
.
I think it could be improved having the field to be renamed to smartStateEnabled
so that it's clear the boolean refers to Smart State begin enabled in the analysis.
Then we will change the UI to manage this boolean field accordingly (https://issues.redhat.com/browse/MIGENG-370)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrizzi @jonathanvila I've created a PR (on Jonathan's branch) for renaming type
to smartStateEnabled
; however, this change is just using @JsonProperty("smartStateEnabled")
so it won't affect the current database model. It is not trivial to change the database model since hibernate won't update the database automatically. for us. Maybe in the future, we can introduce a database version control manager like flyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before it was also a boolean on the mutator setType , and it was not clear at all too, then we had a String accessor getType not returning the internal value but transforming it using a hard coded string. So we lived with unclearity also before.
My suggestion is to solve the type of the attribute now and in a separate ticket rename the attribute, and execute the rename into the database or implement Flyway (or any other DB change tool ) in order to move forward with this PR
…Configuration to any profile except test
src/main/java/org/jboss/xavier/integrations/route/MainRouteBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/jboss/xavier/integrations/route/MainRouteBuilder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of more comments
@@ -28,14 +28,14 @@ | |||
@Test | |||
@Ignore | |||
public void s3Test() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this test is ignored even in the master branch but if this Test Class is used somehow I would suggest to fix it and remove the @ignore; otherwise, we can delete this in order to clean the source code. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well this test is here because it was handy to test the S3 component. We can remove it , but I wanted to leave it there in order to have the code if we need to test more things with the component.
- docker-compose --version | ||
- docker info | ||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | ||
- sudo apt-get update | ||
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce | ||
- sudo rm /usr/local/bin/docker-compose | ||
- curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 > docker-compose | ||
- chmod +x docker-compose | ||
- sudo mv docker-compose /usr/local/bin | ||
- docker-compose --version | ||
- docker info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest using the default versions of Travis so when Travis will upgrade the Docker and Docker Compose versions we will have it without any change in our side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I wanted to fix a version that we know it works.... yes using the default we will have updates, for the good and for the bad, as we dont know if Testcontainers will cope with the same version of the docker installed in Travis.
@@ -372,11 +372,9 @@ public void DirectCalculateVMWorkloadInventoryModel_ShouldPersistScanRunModel() | |||
Assert.assertNotNull(scanRunModels); | |||
Assert.assertEquals(2, scanRunModels.size()); | |||
|
|||
scanRunModels.stream().filter(model -> model.getId() % 2 == 0).forEach(srm -> | |||
Assert.assertEquals("Virt Platform", srm.getType())); | |||
Assert.assertTrue(scanRunModels.stream().filter(model -> model.getId() % 2 == 0).allMatch(srm -> !srm.getType())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a reminder to not forget to create the ticket for changing the UI.
@@ -0,0 +1,38 @@ | |||
version: '2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be wrong but it seems to me that this file is not used in the end2end tests. We can remove this file, What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is there because it helped to start the compose with KIE and test the commands. We can remove it , but I left it here in order to have the yaml if we need to do further tests with the compose.
@@ -0,0 +1,99 @@ | |||
#!/usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be wrong but it seems to me that this file is not used in the end2end tests. We can remove this file, What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as with the kie compose. It was helpful to have it in order to recreate the infrastracture with the compose. We can remove it , but I thought it was interesting to have it.
@Value("${minio.host:x}") | ||
private String minio_host; | ||
|
||
public static class Initializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have the limitation of writing just one Test method by Class, then I would suggest moving the Initializer
class outside the EndToEndTest.java
class since it might be used by future Test Class. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed; my idea is to make some parts of the Class reusable by future End2End test classes. However, I agree that for now there are no other End2End tests in mind so we can postpone the refactoring of this class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we talked, moving the initializer out of the class will convert it in a non static class .... and also it needs the values from the containers started ( ip and port ) there fore we need to have the initializer and the test class on sync. So I dont see much benefit on moving the class out and it will complicate things a bit.
Also, I think reusable is interesting but only when you need to reuse....
…nmodel ScanRunModel: change `type` by `smartStateEnabled`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jonathanvila for applying all the changes we discussed during the last couple of weeks :)... as far as I'm concern, this PR looks good to me so I'll approve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathanvila i ran it locally 3 times and i found one issue with a command in a script.
/usr/bin/mc config host add myminio http://$1 BQA2GEXO711FVBVXDWKM uvgz3LCwWM3e400cDkQIH/y1Y4xgU4iV91CwFSPC; | ||
/usr/bin/mc mb myminio/insights-upload-perma; | ||
/usr/bin/mc mb myminio/insights-upload-rejected; | ||
/usr/bin/mc policy download myminio/insights-upload-perma; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seem that locally this command didn't work for me since in the log it prints the usage output:
16:31:12.000 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: Added `myminio` successfully.
16:31:12.000 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: Bucket created successfully `myminio/insights-upload-perma`.
16:31:12.000 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: Bucket created successfully `myminio/insights-upload-rejected`.
16:31:12.000 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: Name:
16:31:12.000 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: mc policy - manage anonymous access to buckets and objects
16:31:12.076 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: USAGE:
16:31:12.077 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: mc policy set [FLAGS] PERMISSION TARGET
16:31:12.077 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: mc policy set-json [FLAGS] FILE TARGET
16:31:12.077 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: mc policy get [FLAGS] TARGET
16:31:12.077 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: mc policy get-json [FLAGS] TARGET
16:31:12.077 [tc-okhttp-stream-2142129482] INFO o.j.xavier.integrations.EndToEndTest - [MINIO-MC-LOG] STDOUT: mc policy list [FLAGS] TARGET
… they are wrong and apparently not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes worked for me.
Thanks @jonathanvila for this improvement to help us improve code's stability and maintainability.
Thanks @bsideup for the help and support 👍
https://issues.redhat.com/browse/MIGENG-365
This E2E test is based in these assumptions :
To do this it's used :