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: v2_repository_analyze_test.go
    path of file: ./repos/cds/engine/api
    
    the code of the file until where you have to start completion: package api

import (
	"archive/tar"
	"bytes"
	"compress/gzip"
	"context"
	"encoding/base64"
	"fmt"

	"github.com/ovh/cds/engine/api/workflow_v2"

	"io"
	"net/http"
	"testing"
	"time"

	"github.com/golang/mock/gomock"
	"github.com/stretchr/testify/require"

	"github.com/ovh/cds/engine/api/entity"
	"github.com/ovh/cds/engine/api/link"
	"github.com/ovh/cds/engine/api/repository"
	"github.com/ov
    
func TestAnalyzeGithubGPGKeyNotFound(t *testing.T) {
	api, db, _ := newTestAPI(t)
	ctx := context.TODO()

	// Create project
	key1 := sdk.RandomString(10)
	proj1 := assets.InsertTestProject(t, db, api.Cache, key1, key1)

	userKey, err := user.LoadGPGKeyByKeyID(ctx, db, "F344BDDCE15F17D7")
	if err != nil && !sdk.ErrorIs(err, sdk.ErrNotFound) {
		require.NoError(t, err)
	}
	if userKey != nil {
		require.NoError(t, user.DeleteGPGKey(db, *userKey))
	}

	// Create VCS
	vcsProject := assets.InsertTestVCSProject(t, db, proj1.ID, "vcs-server", "github")

	repo := sdk.ProjectRepository{
		Name:         "myrepo",
		Created:      time.Now(),
		VCSProjectID: vcsProject.ID,
		CreatedBy:    "me",
		ProjectKey:   proj1.Key,
	}
	require.NoError(t, repository.Insert(context.TODO(), db, &repo))

	analysis := sdk.ProjectRepositoryAnalysis{
		ID:                  "",
		Status:              sdk.RepositoryAnalysisStatusInProgress,
		Commit:              "abcdef",
		ProjectKey:          proj1.Key,
		ProjectRepositoryID: repo.ID,
		Created:             time.Now(),
		LastModified:        time.Now(),
		Ref:                 "refs/heads/master",
		VCSProjectID:        vcsProject.ID,
	}
	require.NoError(t, repository.InsertAnalysis(ctx, db, &analysis))

	// Mock VCS
	s, _ := assets.InsertService(t, db, t.Name()+"_VCS", sdk.TypeVCS)
	// Setup a mock for all services called by the API
	ctrl := gomock.NewController(t)
	defer ctrl.Finish()
	servicesClients := mock_services.NewMockClient(ctrl)
	services.NewClient = func(_ []sdk.Service) services.Client {
		return servicesClients
	}
	defer func() {
		_ = services.Delete(db, s)
		services.NewClient = services.NewDefaultClient
	}()

	servicesClients.EXPECT().
		DoJSONRequest(gomock.Any(), "GET", "/vcs/vcs-server/repos/myrepo/commits/abcdef", gomock.Any(), gomock.Any(), gomock.Any()).
		DoAndReturn(
			func(ctx context.Context, method, path string, in interface{}, out interface{}, _ interface{}) (http.Header, int, error) {
				commit := &sdk.VCSCommit{
					Signature: "-----BEGIN PGP SIGNATURE-----\n\niQIzBAABCAAdFiEEfYJxMHx+E0DPuqaA80S93OFfF9cFAmME7aIACgkQ80S93OFf\nF9eFWBAAq5hOcZIx/A+8J6/NwRtXMs5OW+TJxzJb5siXdRC8Mjrm+fqwpTPPHqtB\nbb7iuiRnmY/HqCegULiw4qVxDyA3sswyDHPLcyUcfG4drJGylPW9ZYg3YeRslX2B\niQykYZyd4h3R/euYAuBKA9vMGoWnaU/Vh22A11Po1pXpPq623FTkiFOSAZrD8Hql\nEvmlhw26qHSPlhsdSKsR+/FPvpLUXlNUiYB5oq7W9qy0yOOafgwZ9r3vvxshzvkt\nvW5zG+R05thQ8icCyrWfEfIWp+TTtQX3asOopnQG9dFs2LRODLXXaHTRVRB/MWPa\nNVvUD/dIzBVyNimpik+2Uqq5jWNiXavQmqoxyL9n4A372AIH7Hu78NnfmAz7VnYo\nyVHRNBryiCcYNj5g0x/WnGsDuhQr7170ODw7QfEYJdCPxGgYuhdYovHdjcMcgWpF\ncWEtayj8bhuLTjjxEsqXTv+psxwB55N5OUvyXmNAaFLhJSEI+l1VHW14L3gZFdPT\n+VgPQtT9a1+GEjPqLvZ6wLVTcSI9uogK6NHowmyM261FtFQqLVdkOdUU8RCR8qLC\nekZWQaJutqicIZTolAQyBPBw8aQz0i+uBUgdWkoiHf/zEEudu0b06IpDq2oYFFVH\nVmCuZ3/AcXrW6T3XXcE5pu+Rvsi57O7iR8i7TIP0CaDTr2FfQWc=\n=/H7t\n-----END PGP SIGNATURE-----",
					Verified:  true,
					Hash:      "abcdef",
				}
				*(out.(*sdk.VCSCommit)) = *commit
				return nil, 200, nil
			},
		).MaxTimes(1)

	require.NoError(t, api.analyzeRepository(ctx, repo.ID, analysis.ID))

	analysisUpdated, err := repository.LoadRepositoryAnalysisById(ctx, db, repo.ID, analysis.ID)
	require.NoError(t, err)
	require.Equal(t, sdk.RepositoryAnalysisStatusSkipped, analysisUpdated.Status)
	require.Equal(t, "gpgkey F344BDDCE15F17D7 not found", analysisUpdated.Data.Error)
}