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

(bug) Unable to assert test case on venom.datetime #759

Open
bcecchinato opened this issue Dec 5, 2023 · 5 comments
Open

(bug) Unable to assert test case on venom.datetime #759

bcecchinato opened this issue Dec 5, 2023 · 5 comments
Labels

Comments

@bcecchinato
Copy link

Hello !

This test fails every time :

---
name: "test"
testcases:
  - name: "Bad RFC"
    steps:
      - name: "Say hello"
        type: exec
        script: echo "Hello !"
        delay: 60
        assertions:
          - result.code MustEqual 0
          - venom.datetime MustHappenOnOrAfter "300 seconds from now"
        retry: 1000
        retry_if:
          - result.code MustEqual 0
          - venom.datetime MustHappenOnOrBefore "300 seconds from now" 

The result output is :

 • test (test.yml)
     • Bad-RFC
         • Assert Flip Resistor FAIL
           Testcase "Bad RFC", step #0-0: retry conditions not fulfilled, skipping 1000 remaining retries (test.yml:8)
           Testcase "Bad RFC", step #0-0: Assertion "venom.datetime MustHappenOnOrAfter \"300 seconds from now\"" failed. invalid date provided with %!q(<nil>) not in RFC3339 format or humanize format (test.yml:12)
           Testcase "Bad RFC", step #0-0: At least one required assertion failed, skipping remaining steps (test.yml:8)
           0 other steps were skipped 

The variable venom.datetime doesn't look to be populated.

@ivan-velasco
Copy link
Contributor

If you run in verbose do you see a format for venom.datetime such as 2024-02-21T15:30:45Z

@bcecchinato

@bcecchinato
Copy link
Author

@ivan-velasco The field looks to be formatted indeed, here is the output of the test :

{
  "test_suites": [
    {
      "name": "test",
      "testcases": [
        {
          "name": "Bad-RFC",
          "vars": {
            "__Len__": "8",
            "__Type__": "Map",
            "venom.datetime": "2024-02-23T08:01:17+01:00",
            "venom.executable": "/usr/local/sbin/venom",
            "venom.libdir": "/etc/venom",
            "venom.outputdir": "/var/log/venom",
            "venom.testcase": "Bad-RFC",
            "venom.testsuite": "test",
            "venom.testsuite.filename": "test.yml",
            "venom.testsuite.filepath": "test.yml",
            "venom.testsuite.name": "test",
            "venom.testsuite.shortName": "test",
            "venom.testsuite.workdir": "/root",
            "venom.timestamp": "1708671677"
          },
          "skip": null,
          "steps": [
            {
              "assertions": [
                "result.code MustEqual 0",
                "venom.datetime MustHappenOnOrAfter \"300 seconds from now\""
              ],
              "delay": 60,
              "name": "Say hello",
              "retry": 1000,
              "retry_if": [
                "result.code MustEqual 0",
                "venom.datetime MustHappenOnOrBefore \"300 seconds from now\""
              ],
              "script": "echo \"Hello !\"",
              "type": "exec"
            }
          ],
          "skipped": null,
          "status": "FAIL",
          "duration": 0.01584637,
          "start": "2024-02-23T08:01:17.799694028+01:00",
          "end": "2024-02-23T08:01:17.815540399+01:00",
          "results": [
            {
              "name": "Say hello",
              "errors": [
                {
                  "value": "Testcase \"Bad RFC\", step #0-0: retry conditions not fulfilled, skipping 1000 remaining retries (test.yml:8)"
                },
                {
                  "value": "Testcase \"Bad RFC\", step #0-0: Assertion \"venom.datetime MustHappenOnOrAfter \\\"300 seconds from now\\\"\" failed. invalid date RFC3339 provided with %!q(\u003cnil\u003e) (test.yml:12)"
                },
                {
                  "value": "Testcase \"Bad RFC\", step #0-0: At least one required assertion failed, skipping remaining steps (test.yml:8)"
                }
              ],
              "skipped": null,
              "status": "FAIL",
              "raw": "YXNzZXJ0aW9uczoKICAgIC0gcmVzdWx0LmNvZGUgTXVzdEVxdWFsIDAKICAgIC0gdmVub20uZGF0ZXRpbWUgTXVzdEhhcHBlbk9uT3JBZnRlciAiMzAwIHNlY29uZHMgZnJvbSBub3ciCmRlbGF5OiA2MApuYW1lOiBTYXkgaGVsbG8KcmV0cnk6IDEwMDAKcmV0cnlfaWY6CiAgICAtIHJlc3VsdC5jb2RlIE11c3RFcXVhbCAwCiAgICAtIHZlbm9tLmRhdGV0aW1lIE11c3RIYXBwZW5Pbk9yQmVmb3JlICIzMDAgc2Vjb25kcyBmcm9tIG5vdyIKc2NyaXB0OiBlY2hvICJIZWxsbyAhIgp0eXBlOiBleGVjCg==",
              "interpolated": "YXNzZXJ0aW9uczoKICAgIC0gcmVzdWx0LmNvZGUgTXVzdEVxdWFsIDAKICAgIC0gdmVub20uZGF0ZXRpbWUgTXVzdEhhcHBlbk9uT3JBZnRlciAiMzAwIHNlY29uZHMgZnJvbSBub3ciCmRlbGF5OiA2MApuYW1lOiBTYXkgaGVsbG8KcmV0cnk6IDEwMDAKcmV0cnlfaWY6CiAgICAtIHJlc3VsdC5jb2RlIE11c3RFcXVhbCAwCiAgICAtIHZlbm9tLmRhdGV0aW1lIE11c3RIYXBwZW5Pbk9yQmVmb3JlICIzMDAgc2Vjb25kcyBmcm9tIG5vdyIKc2NyaXB0OiBlY2hvICJIZWxsbyAhIgp0eXBlOiBleGVjCg==",
              "number": 0,
              "rangedIndex": 0,
              "rangedEnable": false,
              "inputVars": {
                "__Len__": "15",
                "__Type__": "Map",
                "venom.datetime": "2024-02-23T08:01:17+01:00",
                "venom.executable": "/usr/local/sbin/venom",
                "venom.libdir": "/etc/venom",
                "venom.outputdir": "/var/log/venom",
                "venom.testcase": "Bad-RFC",
                "venom.teststep.number": "0",
                "venom.testsuite": "test",
                "venom.testsuite.filename": "test.yml",
                "venom.testsuite.filepath": "test.yml",
                "venom.testsuite.name": "test",
                "venom.testsuite.shortName": "test",
                "venom.testsuite.workdir": "/root",
                "venom.timestamp": "1708671677"
              },
              "computedVars": null,
              "computedInfos": null,
              "assertionsApplied": {
                "ok": false,
                "assertions": [
                  {
                    "assertion": "result.code MustEqual 0",
                    "isOK": true
                  },
                  {
                    "assertion": "venom.datetime MustHappenOnOrAfter \"300 seconds from now\"",
                    "isOK": false
                  }
                ]
              },
              "systemout": "Hello !\n",
              "systemerr": "\n",
              "duration": 0.011183072,
              "start": "2024-02-23T08:01:17.80373463+01:00",
              "end": "2024-02-23T08:01:17.814917963+01:00"
            }
          ]
        }
      ],
      "vars": {
        "__Len__": "8",
        "__Type__": "Map",
        "venom.datetime": "2024-02-23T08:01:17+01:00",
        "venom.executable": "/usr/local/sbin/venom",
        "venom.libdir": "/etc/venom",
        "venom.outputdir": "/var/log/venom",
        "venom.testsuite": "test",
        "venom.testsuite.filename": "test.yml",
        "venom.testsuite.filepath": "test.yml",
        "venom.testsuite.name": "test",
        "venom.testsuite.shortName": "test",
        "venom.testsuite.workdir": "/root",
        "venom.timestamp": "1708671677"
      },
      "shortname": "test",
      "filename": "test.yml",
      "filepath": "test.yml",
      "computed_vars": {
        "Bad-RFC.__type__": "Result",
        "Bad-RFC.result.__len__": 7,
        "Bad-RFC.result.code": "0",
        "Bad-RFC.result.err": "",
        "Bad-RFC.result.systemerr": "",
        "Bad-RFC.result.systemerrjson": "",
        "Bad-RFC.result.systemout": "Hello !",
        "Bad-RFC.result.systemoutjson": "",
        "Bad-RFC.result.timeseconds": 0.008669681
      },
      "workdir": "/root",
      "status": "FAIL",
      "duration": 0.016198239,
      "start": "2024-02-23T08:01:17.799410023+01:00",
      "end": "2024-02-23T08:01:17.815608366+01:00",
      "nbTestcasesFail": 1,
      "nbTestcasesPass": 0,
      "nbTestcasesSkip": 0
    }
  ],
  "status": "FAIL",
  "nbTestsuitesFail": 1,
  "nbTestsuitesPass": 0,
  "nbTestsuitesSkip": 0,
  "duration": 0.016237509,
  "start": "2024-02-23T08:01:17.799376222+01:00",
  "end": "2024-02-23T08:01:17.815613835+01:00"
}

@ivan-velasco
Copy link
Contributor

@bcecchinato If you update the assertion to be 5 minutes from now does that have the same error?

@bcecchinato
Copy link
Author

@ivan-velasco same issue :

	  [trac] writing /var/log/venom/venom.log
 • test (test.yml)
 	• Bad-RFC
 		• Say hello FAIL
 		  Testcase "Bad RFC", step #0-0: retry conditions not fulfilled, skipping 1000 remaining retries (test.yml:8)
 		  Testcase "Bad RFC", step #0-0: Assertion "venom.datetime MustHappenOnOrAfter \"5 minutes from now\"" failed. invalid date RFC3339 provided with %!q(<nil>) (test.yml:12)
 		  Testcase "Bad RFC", step #0-0: At least one required assertion failed, skipping remaining steps (test.yml:8)
 		  0 other steps were skipped

@william-hyy
Copy link

I am having the same issue when comparing 2 different dates

@github-actions github-actions bot added the Stale label Aug 13, 2024
@yesnault yesnault reopened this Aug 13, 2024
@yesnault yesnault added bug and removed Stale labels Aug 13, 2024
@github-actions github-actions bot added the Stale label Aug 28, 2024
@yesnault yesnault removed the Stale label Aug 28, 2024
@yesnault yesnault reopened this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants