You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: setup_compat.go
    path of file: ./repos/FerretDB/integration/setup
    
    the code of the file until where you have to start completion: // Copyright 2021 FerretDB Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package setup

import (
	"context"
	"fmt"
	"runtime/trace"
	"strings"

	"github.com/stretchr/testify/require"
	"go.mongodb.org/mongo-driver/bson"
	"go.mongodb.org/mongo-driver/mongo"
	"go.opentelemetry.io/otel"
	"go.uber.org/zap"

	"github.com/FerretDB/FerretDB/integration/shareddata"
	"github.com/FerretDB/FerretDB/internal/util/observability"
	"github.com/FerretDB/FerretDB/internal/util/testutil"
	"github.com/FerretDB/FerretDB/internal/util/testutil/testtb"
)

// SetupCompatOpts represents setup options for compatibility test.
//
// Add option to use read-only user.
// TODO https://github.com/FerretDB/FerretDB/issues/1025
type SetupCompatOpts struct {
	// Data providers.
	Providers []shareddata.Provider

	// If true, a non-existent collection will be added to the list of collections.
	// This is useful to test the behavior when a collection is not found.
	//
	// This flag is not needed, always add a non-e
    
func SetupCompatWithOpts(tb testtb.TB, opts *SetupCompatOpts) *SetupCompatResult {
	tb.Helper()

	if *compatURLF == "" {
		tb.Skip("-compat-url is empty, skipping compatibility test")
	}

	ctx, cancel := context.WithCancel(testutil.Ctx(tb))

	setupCtx, span := otel.Tracer("").Start(ctx, "SetupCompatWithOpts")
	defer span.End()

	defer trace.StartRegion(setupCtx, "SetupCompatWithOpts").End()

	if opts == nil {
		opts = new(SetupCompatOpts)
	}

	// When we use `task test-integration` to run `postgresql` and `sqlite` compat tests in parallel,
	// they both use the same MongoDB instance.
	// Add suffix to prevent the usage of the same database.
	suffix := strings.TrimPrefix(*targetBackendF, "ferretdb-")
	switch suffix {
	case "postgresql":
		suffix = "pg"
	case "sqlite":
		suffix = "sl"
	}
	opts.databaseName = testutil.DatabaseName(tb) + "_" + suffix

	// When database name is too long, database is created but inserting documents
	// fail with InvalidNamespace error.
	require.Less(tb, len(opts.databaseName), 64, "database name %q is too long", opts.databaseName)

	opts.baseCollectionName = testutil.CollectionName(tb)

	level := zap.NewAtomicLevelAt(zap.ErrorLevel)
	if *debugSetupF {
		level = zap.NewAtomicLevelAt(zap.DebugLevel)
	}
	logger := testutil.LevelLogger(tb, level)

	var targetClient *mongo.Client
	if *targetURLF == "" {
		uri := setupListener(tb, setupCtx, logger)
		targetClient = setupClient(tb, setupCtx, uri)
	} else {
		targetClient = setupClient(tb, setupCtx, *targetURLF)
	}

	// register cleanup function after setupListener registers its own to preserve full logs
	tb.Cleanup(cancel)

	targetCollections := setupCompatCollections(tb, setupCtx, targetClient, opts, *targetBackendF)

	compatClient := setupClient(tb, setupCtx, *compatURLF)
	compatCollections := setupCompatCollections(tb, setupCtx, compatClient, opts, "mongodb")

	level.SetLevel(*logLevelF)

	return &SetupCompatResult{
		Ctx:               ctx,
		TargetCollections: targetCollections,
		CompatCollections: compatCollections,
	}
}