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

Rework integration test setup and auth #1568

Closed
9 of 11 tasks
AlekSi opened this issue Nov 24, 2022 · 2 comments · Fixed by #1857, #1870, #1878, #1925 or #2225
Closed
9 of 11 tasks

Rework integration test setup and auth #1568

AlekSi opened this issue Nov 24, 2022 · 2 comments · Fixed by #1857, #1870, #1878, #1925 or #2225
Assignees
Labels
code/chore Code maintenance improvements not ready Issues that are not ready to be worked on; PRs that should skip CI

Comments

@AlekSi
Copy link
Member

AlekSi commented Nov 24, 2022

What should be done?

At the moment, we fetch flag values but each test can't assign value for the flag. Additionally -handler flag is used incorrectly for validator.

  • Validators should be used only for target. When we run compatibility tests with target=tigris and compat=MongoDB, we get validators for tigris handler for both databases and then ignore MongoDB's error. In general, -handler's flag value is used incorrectly.
    func setupCompatCollections(tb testing.TB, ctx context.Context, client *mongo.Client, opts *SetupCompatOpts) []*mongo.Collection {
  • Integration setup uses flag's value but unable to specify flags used per test cases. Enable test cases to test authentication.
    PostgreSQLURL: *postgreSQLURLF,
  • Test different flags values of env data TestEnvData.
  • Test different flag values of postgresql-url in TestCommandsAuthenticationSASLStart
  • Provider is compatible with both compat and target, but validator is only compatible with target. Fix this definition
    // Handlers returns handlers compatible with this provider.
    Handlers() []string
    // Validators returns validators for the given handler and collection.
    // For example, for Tigris it should return a map with they key $tigrisSchemaString
    // and the value containing Tigris' JSON schema string.
    Validators(handler, collection string) map[string]any
  • pg uri used for testing is set from creating a new listener or using existing connection on port. Rework on how uri is built and used. Currently attempting all possible combinations. Probably this wouldn't help for speed.
    for _, c := range []struct {
    user *url.Userinfo
    authMechanism string
    }{{
    user: nil,
    authMechanism: "",
    }, {
    user: url.UserPassword("username", "password"),
    authMechanism: "PLAIN",
    }, {
    user: url.UserPassword("username", "password"),
    authMechanism: "", // defaults to SCRAM when username is set
  • Remove code like
    // Attempt to create a collection for Tigris with a schema.
    // If we get an error that support for "validator" is not implemented, that's Postgres.
    // If we get an error that "$tigrisSchemaString" is unknown, that's MongoDB.
    // In both cases, we create a collection without a schema.
    err := db.CreateCollection(ctx, collName, &opts)
    if err != nil {
    if errorTextContains(err,
    `support for field "validator" is not implemented yet`,
    `unknown top level operator: $tigrisSchemaString`,
    ) {
    err = db.CreateCollection(ctx, collName)
    }

Keep note that maybe we may want test data per provider.

Where?

See references to this issue in code.

DoD:

  • in compat test, validators are correctly applied for target but not for compat.
  • tests added for TestCommandsAuthenticationSASLStart
    • authentication with PLAIN
    • authentication with invalid credential
    • authentication with valid credential
  • uri for specific target/compat is being built.
  • validator is not used for compat
  • address issue numbers mentioned in the code

@AlekSi AlekSi added the code/chore Code maintenance improvements label Nov 24, 2022
@AlekSi AlekSi assigned ferretdb-bot and unassigned ferretdb-bot Nov 24, 2022
@AlekSi AlekSi self-assigned this Dec 19, 2022
@AlekSi AlekSi mentioned this issue Dec 27, 2022
12 tasks
@AlekSi AlekSi changed the title Integration test setup is not correct for Tigris Rework integration test setup for Tigris and auth Dec 30, 2022
@rumyantseva rumyantseva added not ready Issues that are not ready to be worked on; PRs that should skip CI and removed not ready Issues that are not ready to be worked on; PRs that should skip CI labels Jan 6, 2023
@chilagrow chilagrow assigned chilagrow and unassigned AlekSi Jan 12, 2023
@chilagrow chilagrow reopened this Jan 26, 2023
@AlekSi AlekSi added this to the v0.9.1 milestone Jan 31, 2023
AlekSi pushed a commit that referenced this issue Feb 1, 2023
@AlekSi AlekSi reopened this Feb 1, 2023
@AlekSi AlekSi reopened this Feb 7, 2023
@AlekSi AlekSi assigned AlekSi and chilagrow and unassigned chilagrow Feb 7, 2023
@AlekSi
Copy link
Member Author

AlekSi commented Feb 7, 2023

I will check what else we could do

@AlekSi AlekSi modified the milestones: v0.9.1, v0.9.2 Feb 13, 2023
@AlekSi AlekSi mentioned this issue Feb 20, 2023
9 tasks
AlekSi added a commit that referenced this issue Feb 21, 2023
@AlekSi AlekSi reopened this Feb 21, 2023
@AlekSi AlekSi removed this from the v0.9.2 milestone Feb 27, 2023
@chilagrow chilagrow self-assigned this Mar 16, 2023
@AlekSi AlekSi reopened this Mar 22, 2023
@AlekSi
Copy link
Member Author

AlekSi commented Mar 22, 2023

I will check if we could do something more useful

@AlekSi AlekSi added the not ready Issues that are not ready to be worked on; PRs that should skip CI label May 1, 2023
@AlekSi AlekSi changed the title Rework integration test setup for Tigris and auth Rework integration test setup and auth Jul 6, 2023
@AlekSi AlekSi closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment