Skip to content
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

add natural language datetime assertion #711

Merged
merged 3 commits into from
Sep 20, 2023

Conversation

rhzs
Copy link
Contributor

@rhzs rhzs commented Aug 12, 2023

This PR will add ability to easily assert date time.

Now we can use time assertion in natural language.

Example:

name: test ShouldHappenBetween
testcases:
- name: test assertion with humanize format
  steps:
  - type: exec
    script: "echo {{.venom.datetime}}"
    assertions:
      - "result.systemout ShouldHappenBetween yesterday tomorrow"
      - "result.systemout ShouldHappenBetween '5 minutes ago' '5 minutes from now'"

This PR uses https://github.com/tj/go-naturaldate to support the natural language.

@rhzs rhzs force-pushed the feat/natural-datetime branch 2 times, most recently from 3993b50 to 2ad9c28 Compare August 12, 2023 15:57
@ovh-cds
Copy link
Collaborator

ovh-cds commented Sep 7, 2023

CDS Report build-venom-a#85.0 ✘

  • Build
    • Build ✔
    • Unit Tests ✘

@@ -1346,6 +1374,13 @@ func TestShouldHappenBetween(t *testing.T) {
},
wantErr: true,
},
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing:

assertions_test.go:1388: ShouldHappenBetween() error = expected '2023-09-07 09:06:34.28230254 +0000 UTC m=+0.000668682' to be between '2023-09-07 01:00:00 +0000 UTC' and '2023-09-07 01:00:00 +0000 UTC' , wantErr false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you check again?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhzs it's ok, thank you. LGTM

Signed-off-by: Rheza Satria <[email protected]>
Signed-off-by: Rheza Satria <[email protected]>
@ovh-cds
Copy link
Collaborator

ovh-cds commented Sep 18, 2023

CDS Report build-venom-a#94.0 ✘

  • Build
    • Build ✔
    • Unit Tests ✔
  • Tests
    • Acceptance Tests ✘

@ovh-cds
Copy link
Collaborator

ovh-cds commented Sep 19, 2023

CDS Report build-venom-a#94.1 ✘

  • Build
    • Build ✔
    • Unit Tests ✔
  • Tests
    • Acceptance Tests ✘

@ovh-cds
Copy link
Collaborator

ovh-cds commented Sep 19, 2023

CDS Report build-venom-a#94.2 ✘

  • Build
    • Build ✔
    • Unit Tests ✔
  • Tests
    • Acceptance Tests ✘

@ovh-cds
Copy link
Collaborator

ovh-cds commented Sep 20, 2023

CDS Report build-venom-a#94.3 ✘

  • Build
    • Build ✔
    • Unit Tests ✔
  • Tests
    • Acceptance Tests ✘

@yesnault yesnault merged commit 408bcdf into ovh:master Sep 20, 2023
1 check passed
@rhzs rhzs deleted the feat/natural-datetime branch September 25, 2023 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants