-
Notifications
You must be signed in to change notification settings - Fork 44
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
MGMT-12054: Support discovery kernel arguments for full-iso and minimal-iso #99
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #99 +/- ##
==========================================
+ Coverage 68.29% 68.70% +0.40%
==========================================
Files 17 18 +1
Lines 858 965 +107
==========================================
+ Hits 586 663 +77
- Misses 172 192 +20
- Partials 100 110 +10
|
/assign @avishayt |
Ahhh wait, is there a reason this code isn't using |
@cgwalters I think there are still a few gaps. The last feature gap IIRC was that the minimal ISO generated by coreos-installer doesn't let us set up our static networking (posisibly for multiple interfaces) and proxy information before pulling the rootfs. I recall talking to @jlebon about this a while back |
But it may very well be time to meet up again to discuss if everything is covered now. |
hmmm also even if I think it would be good to move this discussion out of this PR though. I'll open an issue for us to consider |
Yeah, we discussed this in the past. The use of |
Opened https://issues.redhat.com/browse/MGMT-12340 to track this. |
1b82ec9
to
0232f7f
Compare
0232f7f
to
e45551f
Compare
e45551f
to
243ce96
Compare
As a separate enhancement we should probably expand our use of this file to use it to determine where to add the rootfs parameter when creating the minimal iso. This would probably solve some problems (or at least minimize the amount we would need to fix) for the IBM folks doing power and Z integration. |
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.
Just a few test comments. Looks good otherwise though.
243ce96
to
53986da
Compare
pkg/isoeditor/kargs_test.go
Outdated
return mockBoundariesFinderCreator(0, 0, errors.New("this is an error")) | ||
} | ||
|
||
Context("kargs files", func() { |
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'm going to reply to your old comment here just so it's not outdated, but TLDR is this should be Describe("kargsFiles"
because it's grouping tests of that function. It's good to have the function name right in the test.
In reply to #99 (comment):
BTW, go does not allow reference from non-test code to test code.
This is interesting. I would expect this if the tests were in a different package, but it's surprising to me that it seems to omit *_test.go
files when compiling main.
That said, if you reference things defined in test files from real ones and run the tests, it works.
To me it's unintuitive and feels like "magic" so I'd like to avoid defining stuff at the top level in tests anyway.
I think
Describe
is unexpected withinContext
although it is allowed.
I don't think so at all. Describe
and Context
are functionally identical. They only differ semantically. Generally I use Describe
to group tests of a particular function and Context
when I need shared setup for tests of multiple functions.
If you need shared setup only for the tests of a single function, I'd put it in that function's Describe
block.
https://github.com/openshift/assisted-image-service/blob/d7fecdd94b334150af7daf53b9fca04722d32582/pkg/isoeditor/isoutil_test.go is a good example where multiple Describe
s need the same context.
The text with karg helpers looks unclear to me.
The exact text isn't super important in this case since every test is in the same context. It might as well stay "kargs tests"
TLDR is Describe
is for grouping It
blocks for the same function and Context
is for denoting shared setup/teardown.
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.
That said, if you reference things defined in test files from real ones and run the tests, it works.
No it doesn't
I usually use Describe
as the most external function. That's the most common use in the assisted service. There are many few external Context
functions.
If you think it is very significant I will change.
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 it doesn't
I wouldn't have asserted something like this if I didn't test it 😉
I have a module written that reproduces this behavior, but that said I did also find golang/go#10184 (comment) which explains how it could never cause a real problem.
If you think it is very significant I will change.
Not very significant, but I wrote this all up mostly to just explain how I think about writing tests. If my descriptions and examples haven't impacted how you want to write these up that's okay. As I said Context
and Describe
are functionally equivalent.
The only thing I would very much like to see is the container (Context
or Describe
) that is grouping tests for a particular function be named after that function. That way it is very clear what is being tested when a test fails.
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 wouldn't have asserted something like this if I didn't test it
I have a module written that reproduces this behavior, but that said I did also find golang/go#10184 (comment) which explains how it could never cause a real problem.
Well that's strange because I tested it too.
In the same package, I tried to reference in non-test file a const
that is defined in test file. The symbol was invisible.
Specifically tried on the const
you made the initial comment on.
/hold |
53986da
to
b28eeda
Compare
/unhold |
da5e382
to
9d7b4d8
Compare
…al-iso When streaming the discovery ISO file, the kernel arguments are included as part of some files: grub.cfg and isolinux.cfg Each of these files contains an area where the kernel arguments can be embedded. This are can be identified by the regex "(\n#+) COREOS_KARG_EMBED_AREA". The arguments should overwrite this are from the beginning and should not pass the last # (hash sign). To do that, an overlay was created. In new Openshift versions, there is a file that contains the file names, while in old versions the file does not exist. If the file exists, the files to embed the kernel arguments are taken from this config file. Otherwise, the default files [/EFI/redhat/grub.cfg, /isolinux/isolinux.cfg] are used.
9d7b4d8
to
d7bb8b0
Compare
@ori-amizur: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carbonin, ori-amizur The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When streaming the discovery ISO file, the kernel arguments are included as part of some files: grub.cfg and isolinux.cfg
Each of these files contains an area where the kernel arguments can be embedded. This are can be identified by the regex "(\n#+) COREOS_KARG_EMBED_AREA". The arguments should overwrite this are from the beginning and should not pass the last # (hash sign). To do that, an overlay was created.
In new Openshift versions, there is a file that contains the file names, while in old versions the file does not exist. If the file exists, the files to embed the kernel arguments are taken from this config file. Otherwise, the default files [/EFI/redhat/grub.cfg, /isolinux/isolinux.cfg] are used.
Description
How was this code tested?
Assignees
/cc @carbonin
/cc @filanov
Links
Checklist
docs
, README, etc)