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: ticket_test.go
    path of file: ./repos/open-match/testing/e2e
    
    the code of the file until where you have to start completion: // Copyright 2019 Google LLC
//
// 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 e2e

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

	"google.golang.org/protobuf/proto"
	"google.golang.org/protobuf/types/known/timestamppb"

	"github.com/stretchr/testify/require"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
	"open-match.dev/open-match/pkg/pb"
)

// TestAssignTickets covers assigning multiple tickets, using two different
// assignment groups.
func TestAssignTickets(t *testing.T) {
	om := newOM(t)
	ctx := context.Background()

	t1, err := om.Frontend().CreateTicket(ctx, &pb.CreateTicketRequest{Ticket: &pb.Ticket{}})
	require.Nil(t, err)
	t2, err := om.Frontend().CreateTicket(ctx, &pb.CreateTicketRequest{Ticket
    
func TestReleaseAllTickets(t *testing.T) {
	om := newOM(t)
	ctx := context.Background()

	var ticket *pb.Ticket

	{ // Create ticket
		var err error
		ticket, err = om.Frontend().CreateTicket(ctx, &pb.CreateTicketRequest{Ticket: &pb.Ticket{}})
		require.Nil(t, err)
		require.NotEmpty(t, ticket.Id)
	}

	var matchReturnedAt time.Time

	{ // Ticket returned from match
		om.SetMMF(func(ctx context.Context, profile *pb.MatchProfile, out chan<- *pb.Match) error {
			out <- &pb.Match{
				MatchId: "1",
				Tickets: []*pb.Ticket{ticket},
			}
			return nil
		})
		om.SetEvaluator(func(ctx context.Context, in <-chan *pb.Match, out chan<- string) error {
			m := <-in
			_, ok := <-in
			require.False(t, ok)
			matchReturnedAt = time.Now()
			out <- m.MatchId
			return nil
		})

		stream, err := om.Backend().FetchMatches(ctx, &pb.FetchMatchesRequest{
			Config: om.MMFConfigGRPC(),
			Profile: &pb.MatchProfile{
				Name: "test-profile",
				Pools: []*pb.Pool{
					{Name: "pool"},
				},
			},
		})
		require.Nil(t, err)

		resp, err := stream.Recv()
		require.Nil(t, err)
		require.Len(t, resp.Match.Tickets, 1)
		require.Equal(t, ticket.Id, resp.Match.Tickets[0].Id)

		resp, err = stream.Recv()
		require.Equal(t, io.EOF, err)
		require.Nil(t, resp)
	}

	{ // Return ticket
		resp, err := om.Backend().ReleaseAllTickets(ctx, &pb.ReleaseAllTicketsRequest{})

		require.Nil(t, err)
		expected := &pb.ReleaseAllTicketsResponse{}
		require.True(t, proto.Equal(expected, resp), fmt.Sprintf("Protobuf messages are not equal\nexpected: %v\nactual: %v", expected, resp))
	}

	{ // Ticket present in query
		stream, err := om.Query().QueryTickets(ctx, &pb.QueryTicketsRequest{Pool: &pb.Pool{}})
		require.Nil(t, err)

		resp, err := stream.Recv()
		require.Nil(t, err)
		require.Len(t, resp.Tickets, 1)
		require.Equal(t, ticket.Id, resp.Tickets[0].Id)

		resp, err = stream.Recv()
		require.Equal(t, io.EOF, err)
		require.Nil(t, resp)
	}

	// Ensure that the release timeout did NOT have enough time to affect this
	// test.
	require.True(t, time.Since(matchReturnedAt) < pendingReleaseTimeout, "%s", time.Since(matchReturnedAt))
}