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: index_usage_stats_test.go
    path of file: ./repos/cockroach/pkg/server
    
    the code of the file until where you have to start completion: // Copyright 2021 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package server

import (
	"context"
	"fmt"
	"testing"
	"time"

	"github.com/cockroachdb/cockroach/pkg/base"
	"github.com/cockroachdb/cockroach/pkg/roachpb"
	"github.com/cockroachdb/cockroach/pkg/server/authserver"
	"github.com/cockroachdb/cockroach/pkg/server/serverpb"
	"github.com/cockroachdb/cockroach/pkg/server/srvtestutils"
	"github.com/cockroachdb/cockroach/pkg/sql"
	"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
	"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
	"github.com/cockroachdb/cockroach/pkg/util/leaktest"
	"github.com/cockroachdb/cockroach/pkg/util/log"
	"github.com/cockroachdb/cockroach/pkg/util/timeutil"
	"github.com/stretchr/testify/require"
)

func compareTimeHelper(t *testing.T, expected, actual time.Time, delta time.Duration) {
	diff := actual.Sub(expected)
	require.True(t, diff < delta, "expected delta %s, but found %s", delta, diff
    
func TestGetTableID(t *testing.T) {
	defer leaktest.AfterTest(t)()
	defer log.Scope(t).Close(t)

	ctx := context.Background()
	s, sqlDB, _ := serverutils.StartServer(t, base.TestServerArgs{})
	defer s.Stopper().Stop(ctx)
	db := sqlutils.MakeSQLRunner(sqlDB)

	// Create tables under public and user defined schemas.
	db.Exec(t, `
CREATE DATABASE test_db1;
SET DATABASE=test_db1;
CREATE TABLE test_table (
  k INT PRIMARY KEY,
  a INT,
  b INT,
  INDEX(a)
);
CREATE SCHEMA schema;
CREATE TABLE schema.test_table (
  k INT PRIMARY KEY,
  a INT,
  b INT,
  INDEX(a)
);
`)

	// Create tables under public and user defined schemas under a different database.
	db.Exec(t, `
CREATE DATABASE test_db2;
SET DATABASE=test_db2;
CREATE TABLE test_table (
  k INT PRIMARY KEY,
  a INT,
  b INT,
  INDEX(a)
);
CREATE SCHEMA schema;
CREATE TABLE schema.test_table (
  k INT PRIMARY KEY,
  a INT,
  b INT,
  INDEX(a)
);
`)

	// Get Table IDs.
	userName, err := authserver.UserFromIncomingRPCContext(ctx)
	require.NoError(t, err)

	testCases := []struct {
		database string
		schema   string
		table    string
	}{
		{
			database: "test_db1",
			schema:   "public",
			table:    "test_table",
		},
		{
			database: "test_db1",
			schema:   "schema",
			table:    "test_table",
		},
		{
			database: "test_db2",
			schema:   "public",
			table:    "test_table",
		},
		{
			database: "test_db2",
			schema:   "schema",
			table:    "test_table",
		},
	}

	for _, tc := range testCases {
		tableName := fmt.Sprintf("%s.%s", tc.schema, tc.table)
		tableID, err := getTableIDFromDatabaseAndTableName(ctx, tc.database, tableName, s.InternalExecutor().(*sql.InternalExecutor), userName)
		require.NoError(t, err)

		// Get actual Table ID.
		actualTableID := db.QueryStr(t, `
SELECT table_id 
FROM crdb_internal.tables 
WHERE database_name=$1 AND schema_name=$2 AND name=$3`,
			tc.database, tc.schema, tc.table)

		// Assert Table ID is correct.
		require.Equal(t, fmt.Sprint(tableID), actualTableID[0][0])
	}
}