-
Notifications
You must be signed in to change notification settings - Fork 251
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
Use own FakeClock func instead of from library #1993
Use own FakeClock func instead of from library #1993
Conversation
We were using clockwork.NewFakeClock() from the clockwork library. With recent changes the implementation of this function changed and it now returns the current date instead of an older date. Creating the function FakeClock() in `pkg/test/helpers.go` so that we can manually hardcode the date and not 100% rely on the library. Signed-off-by: vinamra28 <[email protected]>
Bumps [github.com/jonboulle/clockwork](https://github.com/jonboulle/clockwork) from 0.3.0 to 0.4.0. - [Release notes](https://github.com/jonboulle/clockwork/releases) - [Commits](jonboulle/clockwork@v0.3.0...v0.4.0) --- updated-dependencies: - dependency-name: github.com/jonboulle/clockwork dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
dad8ca5
to
f936776
Compare
@@ -92,3 +94,7 @@ func Contains(t *testing.T, container interface{}, obj interface{}) { | |||
} | |||
t.Errorf("no matches found in: %s", strings.Join(diffs, "\n")) | |||
} | |||
|
|||
func FakeClock() clockwork.FakeClock { | |||
return clockwork.NewFakeClockAt(time.Date(1984, time.April, 4, 0, 0, 0, 0, time.UTC)) |
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.
you may updated the previous default value here.
NewFakeClockAt(time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC))
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, the previous value that we were using was
https://github.com/jonboulle/clockwork/blob/6a247c35607b17156e639c6e0606887fa6fc304f/clockwork.go#L42
NewFakeClockAt(time.Date(1984, time.April, 4, 0, 0, 0, 0, time.UTC))
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.
yes @vinamra28 seems correct otherwise all the tests would ave been failing
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 @vinamra28 , I took the wrong reference
/test pull-tekton-cli-integration-tests |
@vinamra28 do you see any issue with the current default value of Is there any test failing because of this change? |
@jkandasa, yes, test cases were failing as the golden files are getting updated on every run. PR #1970 |
/approve |
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.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jkandasa, piyush-garg 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 |
/lgtm |
/test pull-tekton-cli-integration-tests |
1 similar comment
/test pull-tekton-cli-integration-tests |
#1981 | [vinamra28] Bump versions in README to v0.30.1 | 2023/04/11-07:18 #1983 | [pratap0007] Remove PipelineResource support in clustertask | 2023/04/13-07:24 #1985 | [Zoran Regvart] Adapt for changes in TEP-0100 | 2023/04/13-07:58 #1984 | [pratap0007] Remove PipelineResource support in task | 2023/04/13-09:42 #1988 | [pratap0007] Remove PipelineResource support in pipeline | 2023/04/13-14:54 #1987 | [Basavaraju G] remove e2e pipeline resource tests | 2023/04/13-18:48 #1991 | [dependabot[bot]] Bump k8s.io/apimachinery from 0.26.3 to 0.26.4 | 2023/04/14-07:26 #1992 | [dependabot[bot]] Bump k8s.io/client-go from 0.25.8 to 0.25.9 | 2023/04/14-08:08 #1993 | [vinamra28] Use own FakeClock func instead of from library | 2023/04/14-08:44 #1993 | [dependabot[bot]] Bump github.com/jonboulle/clockwork from 0.3.0 to 0.4.0 | 2023/04/14-08:44 null | [pratap0007] Remove resource command | 2023/04/14-09:36 null | [pratap0007] Remove input and output resource in clustertask describe command | 2023/04/14-11:38 null | [dependabot[bot]] Bump k8s.io/cli-runtime from 0.25.8 to 0.25.9 | 2023/04/14-12:34 null | [Eng Zer Jun] Replace `github.com/ghodss/yaml` with `sigs.k8s.io/yaml` | 2023/04/16-13:44 null | [pratap0007] Remove all occurrence of PipelineResource and move pipeline to 0.46.0 in CI | 2023/04/17-15:06 null | [dependabot[bot]] Bump github.com/docker/cli | 2023/04/19-20:14 null | [Luiz Carvalho] Update to cosign v2 | 2023/04/19-21:38 null | [pratap0007] Remove docs related to PipelineResource | 2023/04/20-10:34 null | [dependabot[bot]] Bump k8s.io/api from 0.26.1 to 0.26.4 | 2023/04/22-04:36 null | [dependabot[bot]] Bump github.com/sigstore/sigstore from 1.6.1 to 1.6.3 | 2023/04/22-05:12 null | [dependabot[bot]] Bump github.com/docker/docker | 2023/04/22-05:46 null | [pratap0007] Remove PipelineResource in the describe command test | 2023/04/25-19:40 null | [PuneetPunamiya] Remove flags from chains payload command as not used | 2023/05/02-10:40 null | [pratap0007] Remove default value info for true flag in delete command | 2023/05/02-13:16 null | [pratap0007] Upgrade golangci version to v1.52.2 and fix lint errors | 2023/05/04-13:26 null | [pratap0007] Bump tektoncd/pipeline to 0.47.0 manually | 2023/05/05-21:34 null | [dependabot[bot]] Bump github.com/docker/cli | 2023/05/06-04:04 null | [dependabot[bot]] Bump github.com/docker/docker | 2023/05/06-04:40 null | [dependabot[bot]] Bump golang.org/x/term from 0.7.0 to 0.8.0 | 2023/05/06-12:58 null | [pratap0007] Fix tkn pr/tr delete command for keep flag | 2023/05/06-16:44 null | [dependabot[bot]] Bump github.com/tektoncd/chains | 2023/05/06-17:24 null | [Piyush Garg] Bump cosign to v2.0.2 | 2023/05/07-06:44 null | [dependabot[bot]] Bump github.com/docker/cli | 2023/05/08-16:42 null | [dependabot[bot]] Bump github.com/docker/docker | 2023/05/08-18:08 null | [dependabot[bot]] Bump github.com/tektoncd/hub from 1.12.1 to 1.13.0 | 2023/05/09-08:08 Signed-off-by: vinamra28 <[email protected]>
Changes
We were using clockwork.NewFakeClock() from the clockwork library. With recent changes the implementation of this function changed and it now returns the current date instead of an older date.
Creating the function FakeClock() in
pkg/test/helpers.go
so that we can manually hardcode the date and not 100% rely on the library.Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make check
make generated
See the contribution guide
for more details.
Release Notes