Create unit test cases for 'ConfigDriveBuilder' class#2674
Conversation
c3e73c4 to
0f3d324
Compare
| public static String fileToBase64String(File isoFile) throws IOException { | ||
| byte[] encoded = Base64.encodeBase64(FileUtils.readFileToByteArray(isoFile)); | ||
| return new String(encoded, StandardCharsets.US_ASCII); | ||
| return new String(encoded, com.cloud.utils.StringUtils.getPreferredCharset()); |
There was a problem hiding this comment.
@rafaelweingartner for base64 encoding should n't we keep it to US_ASCII? Bear in mind that this encoded string is passed over network to agents.
There was a problem hiding this comment.
That is a good question. I noticed that in some places we were using US_ASCII and others the com.cloud.utils.StringUtils.getPreferredCharset(). I asked @DaanHoogland about it.
I can revert this change though. What do you guys think?
There was a problem hiding this comment.
I think let's stick with US_ASCII for both encoding and decoding?
There was a problem hiding this comment.
yeah, i made the same comment
There was a problem hiding this comment.
ok, so I will change that
| */ | ||
| static String generateAndRetrieveIsoAsBase64Iso(String isoFileName, String driveLabel, String tempDirName) throws IOException { | ||
| File tmpIsoStore = new File(tempDirName, isoFileName); | ||
| Script command = new Script("/usr/bin/genisoimage", Duration.standardSeconds(300), LOG); |
There was a problem hiding this comment.
Can you include Daan's change (or @DaanHoogland can you push your change?) around using genisoimage or mkisofs if either is available?
There was a problem hiding this comment.
Is it in some other PR? I can take a look and include it here.
There was a problem hiding this comment.
@rafaelweingartner yes, see Daan's comment here: #2665 (comment)
|
Thanks @rafaelweingartner - I dislike however getting those |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
ah the |
|
@rafaelweingartner I prefer keeping objects open to assignments/change only if necessary, so I keep adding |
|
That is interesting. I am used to do the opposite. I only restrict something, when I want this behavior. Otherwise, I leave them open. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2086 |
| public static String fileToBase64String(File isoFile) throws IOException { | ||
| byte[] encoded = Base64.encodeBase64(FileUtils.readFileToByteArray(isoFile)); | ||
| return new String(encoded, StandardCharsets.US_ASCII); | ||
| return new String(encoded, com.cloud.utils.StringUtils.getPreferredCharset()); |
There was a problem hiding this comment.
the default charset might be different on the MS and the host. something that we might want to force in a test.
There was a problem hiding this comment.
I must change org.apache.cloudstack.storage.configdrive.ConfigDriveBuilder.base64StringToFile(String, String, String) as well, right?
There was a problem hiding this comment.
these must be symetrical and will be running on different host, so yes
This is another method that is causing Jenkins to fail for almost a month
|
@khos2ow I am also fixing that |
|
@rhtyd and @DaanHoogland and finally Jenkins is Green! |
|
@blueorangutan package |
|
@rafaelweingartner a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2087 |
GabrielBrascher
left a comment
There was a problem hiding this comment.
I could only raise a minor issue in the documentation.
All tests have passed and code LGTM.
| /** | ||
| * This is the path to iso file relative to mount point | ||
| * @return config drive iso file path | ||
| * Created the path to ISO file relative to mount point. |
There was a problem hiding this comment.
What do you think of Creates the path to ... instead of Created?
Change formatt to format
There was a problem hiding this comment.
Thanks. Fixed!
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
jenkins is still red but I don't see this as config drive related. We should remove the infamous timeout test. |
|
Ahaha. Everything was green until i fixed a typo :( |
305b78e to
ad3504a
Compare
ad3504a to
c92d1ba
Compare
|
People, all green again! |
|
Trillian test result (tid-2717)
|
|
I will discuss with @PaulAngus before merging any more things in 4.11 while we have an RC out. |
|
Let's merge this @PaulAngus @DaanHoogland ? |
Description
@rhtyd, @DaanHoogland, @wido, and @mike-tutkowski here is the unit tests to remove the dependency of "genisoimage" when building ACS in other operating systems (running maven).
Types of changes
Issues and PRs fixed by this PR
This solves #2671
Also solves #2665
Fixes #2677
Checklist:
Testing