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

pgwire/pgtest: make the tests work both on pg and crdb #49641

Merged
merged 1 commit into from
Jun 1, 2020

Conversation

knz
Copy link
Contributor

@knz knz commented May 28, 2020

There was some accumulated incompatibilities in the test files.
This patch fixes it, and in the process of doing so discovers
two new bugs (#49639 and #49640).

Summary of changes to the DSL:

  • the new only directive skips an entire test file if the db
    does not match (used for the crdb-specific portal bug test file)

  • the new flags crdb_only and noncrdb_only skip over a
    test directive if the db does not match.

  • the new flags ignore_table_oids and ignore_type_oids replace
    the corresponding OIDs in the RowDescription message by 0
    prior to comparing with the expected value.

Release note: None

@knz knz requested review from rafiss, otan and rohany May 28, 2020 13:07
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rohany
Copy link
Contributor

rohany commented May 28, 2020

I wonder if it would be simpler (and feasible in the implementation) instead of have crdb_only and no_crdb on each command to have begin crdb_only and end_crdb_only blocks (same with no_crdb).

@knz
Copy link
Contributor Author

knz commented May 28, 2020

I wonder if it would be simpler (and feasible in the implementation) instead of have crdb_only and no_crdb on each command to have begin crdb_only and end_crdb_only blocks (same with no_crdb).

The datadriven engine does not support this yet unfortunately. Unless you have a suggestion to trick it into it?

@rohany
Copy link
Contributor

rohany commented May 28, 2020

I see, I wasn't sure what the datadriven library could do. LGTM

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz, @otan, @rafiss, and @rohany)


pkg/sql/pgwire/testdata/pgtest/row_description, line 75 at r1 (raw file):

----

until ignore_table_oids

I disagree with adding this directive here -- this test was created to verify that the Table OIDs get populated. See #48417

I'm not sure what to do about the fact that the OIDs differ between CRDB and Postgres. But if I had to pick, then I think the test should be run with crdb_only


pkg/sql/pgwire/testdata/pgtest/row_description, line 171 at r1 (raw file):


# The following discrepancy is another bug.
# See: https://github.com/cockroachdb/cockroach/issues/49640

covered by #49215 as well

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

Thanks for filing the new issues, and for unifying these tests. Very much in favor, except for the changes to the row_description test.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz, @otan, @rafiss, and @rohany)

There was some accumulated incompatibilities in the test files.
This patch fixes it, and in the process of doing so discovers
two new bugs (cockroachdb#49639 and cockroachdb#49640).

Summary of changes to the DSL:

- the new `only` directive skips an entire test file if the db
  does not match (used for the crdb-specific portal bug test file)

- the new flags `crdb_only` and `noncrdb_only` skip over a
  test directive if the db does not match.

- the new flags `ignore_table_oids` and `ignore_type_oids` replace
  the corresponding OIDs in the RowDescription message by 0
  prior to comparing with the expected value.

Release note: None
Copy link
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @otan, @rafiss, and @rohany)


pkg/sql/pgwire/testdata/pgtest/row_description, line 75 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

I disagree with adding this directive here -- this test was created to verify that the Table OIDs get populated. See #48417

I'm not sure what to do about the fact that the OIDs differ between CRDB and Postgres. But if I had to pick, then I think the test should be run with crdb_only

Done.


pkg/sql/pgwire/testdata/pgtest/row_description, line 171 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

covered by #49215 as well

Changed the ref.

@knz
Copy link
Contributor Author

knz commented Jun 1, 2020

friendly ping

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

looks good to me!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @otan, @rafiss, and @rohany)

@knz
Copy link
Contributor Author

knz commented Jun 1, 2020

thanks!

bors r=rafiss,rohany

@craig
Copy link
Contributor

craig bot commented Jun 1, 2020

Build succeeded

@craig craig bot merged commit 521b0c0 into cockroachdb:master Jun 1, 2020
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.

4 participants