Skip to content

Conversation

@cgwalters
Copy link
Member

More prep for #798

I think the second commit is right but need a BYOH team member to verify.

Prep for further changes.
The startup code was trying to do "use kubeconfig if available"
which doesn't make sense to me.  As far as I can tell the openshift-ansible
code doesn't provide one.

Drop it in prep for further changes.
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 17, 2019
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 17, 2019
@runcom
Copy link
Member

runcom commented Jun 17, 2019

For the second commit, as long as it doesn't break the Ingnition path, we're good as they only use that for now.

@vrutkovs
Copy link
Contributor

/test e2e-rhel-scaleup

This would probably fail on CRI-O anyway

@openshift-ci-robot
Copy link
Contributor

@cgwalters: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-rhel-scaleup 49adbf2 link /test e2e-rhel-scaleup

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

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.

@vrutkovs
Copy link
Contributor

That doesn't seem to break MCD once-from, however we can't fully validate the nodes join until openshift/openshift-ansible#11698 lands

Previously the `Run` method dispatched on `onceFrom`, it just flows
better if we make that an explicitly different path in the start
code.
Rather than just doing it in the cluster case.
Since the signal handling is specific to the cluster case, move
that bit into `Run`.
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 18, 2019
@cgwalters
Copy link
Member Author

Pushed a few more changes to this one.

@ashcrow
Copy link
Member

ashcrow commented Jun 18, 2019

This is looking good so far!! ❤️

Doesn't make sense to do this in `start()` and pass it through
the ctors, we only get one value.
Since we now have a `RunOnceFrom`, move the once-from specific
args there.
@cgwalters
Copy link
Member Author

Ohh now I see...I'm basically trying to undo some of the changes in 165f8d4 that factored out the boot id into start so the unit tests could pass a dummy value.

I think testing most of the MCD is just hard to mock fundamentally. @runcom (and others) how about for the MCD we just unit test "easy" parts and leave more heavy lifting testing to the cluster e2e tests?

@kikisdeliveryservice
Copy link
Contributor

I think testing most of the MCD is just hard to mock fundamentally. @runcom (and others) how about for the MCD we just unit test "easy" parts and leave more heavy lifting testing to the cluster e2e tests?

Yeah I agree.. I think the unit tests work best when we are testing some of our logic heavy parts (for ex reconcilable) & "give it this/get that" type functions but don't map that well onto other things imo - sometimes it's either too hard or I end up thinking "I wrote this long unit test but is it really adding any value???" . So I'd say if you feel like the unit test adds value sure, but if you're just doing it to have a unit test but feel like it's diminishing returns it's prob better suited as e2e.

@cgwalters
Copy link
Member Author

And my bootID changed passed CI because it runs on Linux, but I think Antonio at least was running the unit tests on a Mac, so make test-unit would fail in that case.

@cgwalters
Copy link
Member Author

Another variant of this is #760

@cgwalters
Copy link
Member Author

I think I suggested this earlier but maybe what we can do is call os.Getuid() inside the daemon and if it's non-zero assume we're in a dummy mode and don't try to do anything that changes the OS or even assumes we're on Linux.

(To emphasize the reason I'm trying to clean up the MCD entrypoint is I need to add a new variant and there was already a lot of duplication with just 2, adding 3 needs cleanup)

@runcom
Copy link
Member

runcom commented Jun 19, 2019

I think testing most of the MCD is just hard to mock fundamentally. @runcom (and others) how about for the MCD we just unit test "easy" parts and leave more heavy lifting testing to the cluster e2e tests?

yup, I concur with that. I also think our code should be simple enough and well factored that unit tests are still a thing. Unit and e2e testing is anyway really different and there's value in both (otherwise we would have one or the other).

The value in writing units is about writing simple code cause you're forced to factor out functions into simple ones to unit test (and validate them).

The MCD is huge thought so again, I agree with that above in general.

This is ready to go now right? I can see all tests passing.

/approve

@cgwalters
Copy link
Member Author

I also think our code should be simple enough and well factored that unit tests are still a thing.

Oh of course. For example I think the tests I added for kargs worked out well; it's just changing data structures in memory, totally safe and appropriate for a unit.

Looking at say the ssh key unit tests we mock out the actual writing. But if during a code refactor we stopped using the mocking accidentally the unit tests would try to rewrite the user's ssh keys potentially...

This is ready to go now right? I can see all tests passing.

Yeah, but it will break running the unit tests on MacOS as is. Do you care? Any opinion on which approach to take from above? I think I'd lean towards the os.Getuid() approach.

I can do that as a followup? Or do we want to do it in this PR?

@runcom
Copy link
Member

runcom commented Jun 19, 2019

Yeah, but it will break running the unit tests on MacOS as is. Do you care? Any opinion on which approach to take from above? I think I'd lean towards the os.Getuid() approach.

I can do that as a followup? Or do we want to do it in this PR?

I'm the only one with MacOS so I'll just go ahead and live with that test till we follow up to fix this with, uhm, yeah os.Getuid() sounds ok. Let's do a follow up though as this is ready to go anyway now 💪

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 19, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, runcom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants