Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
97947: sql: fix redact_descriptor test r=chengxiong-ruan a=chengxiong-ruan

Fixes: cockroachdb#96928
Previously, we kept `logical` field in the descriptor to when validating result in `redact_descriptor` test. The test failed randomly because of the flaky timestamp. This patch removes `logical` field from the out as well to make the test stable.

Release note: None

Co-authored-by: Chengxiong Ruan <chengxiongruan@gmail.com>
  • Loading branch information
craig[bot] and chengxiong-ruan committed Mar 3, 2023
2 parents bf29912 + 8604a84 commit cd80204
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
28 changes: 16 additions & 12 deletions pkg/ccl/logictestccl/testdata/logic_test/redact_descriptor
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,24 @@ CREATE VIEW redacted_descriptors AS
jsonb_pretty(
regexp_replace(
regexp_replace(
(
crdb_internal.pb_to_json(
'desc',
crdb_internal.redact_descriptor(
descriptor
regexp_replace(
(
crdb_internal.pb_to_json(
'desc',
crdb_internal.redact_descriptor(
descriptor
)
)
)
)::STRING,
'"createdAtNanos": "[0-9]+"',
'"createdAtNanos": "0"',
'g'
)::STRING,
'"createdAtNanos": "[0-9]+"',
'"createdAtNanos": "0"',
'g'
),
'"wallTime": "[0-9]+"',
'"wallTime": "0"'
),
'"wallTime": "[0-9]+"',
'"wallTime": "0"'
'"logical": [0-9]+[,]*',
''
)::JSONB
)
AS descriptor
Expand Down
28 changes: 16 additions & 12 deletions pkg/sql/logictest/testdata/logic_test/redact_descriptor
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ CREATE VIEW redacted_descriptors AS
jsonb_pretty(
regexp_replace(
regexp_replace(
(
crdb_internal.pb_to_json(
'desc',
crdb_internal.redact_descriptor(
descriptor
regexp_replace(
(
crdb_internal.pb_to_json(
'desc',
crdb_internal.redact_descriptor(
descriptor
)
)
)
)::STRING,
'"createdAtNanos": "[0-9]+"',
'"createdAtNanos": "0"',
'g'
)::STRING,
'"createdAtNanos": "[0-9]+"',
'"createdAtNanos": "0"',
'g'
),
'"wallTime": "[0-9]+"',
'"wallTime": "0"'
),
'"wallTime": "[0-9]+"',
'"wallTime": "0"'
'"logical": [0-9]+[,]*',
''
)::JSONB
)
AS descriptor
Expand Down

0 comments on commit cd80204

Please sign in to comment.