finos / datahelix

The DataHelix generator allows you to quickly create data, based on a JSON profile that defines fields and the relationships between them, for the purpose of testing and validation
https://finos.github.io/datahelix/
Apache License 2.0
141 stars 50 forks source link

Set now value to a field via both afterOrAt & beforeOrAt constraints does not work #1707

Closed semisft closed 3 years ago

semisft commented 4 years ago

Bug report

Setting now value to field via both afterOrAt & beforeOrAt constraints does not work. Related to #1706

Description of the bug

Giving two constraints for a date field like afterOrAt=now and beforeOrAt=now must give now as value but does not work.

Steps to reproduce:

Using the profile

{
    "fields": [
        {
            "name": "today",
             "type": "date",
             "nullable": false
        }
    ],
    "constraints": [
        {
            "field": "today",
            "afterOrAt": "now"
        },
        {
            "field": "today",
            "beforeOrAt": "now"
        }       
    ]
}

Run datahelix in random mode. Here are the command line arguments I used to run the profile:

generate
--max-rows=100
--replace
--profile-file=D:\path\to\helix\profile.json
--output-path=D:\path\to\helix\out.csv
--output-format=csv
--generation-type=RANDOM
--set-from-file-directory=D:\path\to\helix

Expected result:

Records with value current date.

Actual result:

The provided profile is wholly contradictory!

Additional context:

After trying equalTo=now #1706, I tried this solution with no luck.

ghost commented 3 years ago

Retested with the latest code, and confirmed to still be an issue. Current output is:

Generation started at: 09:58:42

Number of rows | Velocity (rows/sec) | Velocity trend
---------------+---------------------+---------------
0              | 0                   | Finished

Generation finished at: 09:58:42

The provided profile is wholly contradictory!
No data can be generated!
ghost commented 3 years ago

This is the same issue as identified in #1706, closing as a duplicate - please see the comments in #1706.