kubebuilder-declarative-pattern icon indicating copy to clipboard operation
kubebuilder-declarative-pattern copied to clipboard

Add unit test for direct applier

Open atoato88 opened this issue 3 years ago • 7 comments

What this PR does / why we need it: This PR adds unit tests for direct applier in direct.go.

direct.go doesn't have tests as far, we should add tests for prevent degrades.

For implimenting tests, this PR changes direct applier to have some delegation structures. It is the same manner with that in exec.go

Which issue(s) this PR fixes: Related to #201 comment

Special notes for your reviewer: None

Additional documentation: None

atoato88 avatar Jul 27 '22 02:07 atoato88

/assign @justinsb Could you review this?

atoato88 avatar Jul 27 '22 02:07 atoato88

/retest-required

atoato88 avatar Jul 27 '22 02:07 atoato88

umm, test.sh passed on my laptop, but failure on CI... It looks like that test can't use fake client? :thinking:

atoato88 avatar Jul 27 '22 02:07 atoato88

Current PR needs live k8s cluster, I think. I got same error without live k8s cluster on my laptop.

Is it possible that unit test on fake client without k8s cluster...?

atoato88 avatar Jul 27 '22 05:07 atoato88

/retitle [WIP] Add unit test for direct applier

atoato88 avatar Jul 27 '22 06:07 atoato88

/retitle Add unit test for direct applier Now, ci test become to pass, I remove WIP.

atoato88 avatar Aug 02 '22 08:08 atoato88

This lgtm. In #242 I'm proposing to expand our mockkubeapiserver to the point where the DirectApplier can target it. But this test is still very valuable to check the mapping/behaviour of the flags.

I'm going to approve this, and then we can tackle the questions around whether we need those commented-out cases later?

/approve /lgtm

justinsb avatar Oct 05 '22 14:10 justinsb

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atoato88, justinsb

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:
  • ~~OWNERS~~ [atoato88,justinsb]

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

k8s-ci-robot avatar Oct 05 '22 15:10 k8s-ci-robot