Path: blob/main/dev/preview/previewctl/pkg/ssh/mock.go
2501 views
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package ssh56import (7"context"8"io"910"github.com/cockroachdb/errors"11)1213var _ Client = &MockClient{}1415type MockCmd struct {16CMD string17STDOUT []byte18STDERR []byte19Err error20}2122type MockClient struct {23Command MockCmd24}2526func (m MockClient) Close() error {27return nil28}2930func (m MockClient) Run(ctx context.Context, cmd string, stdout io.Writer, stderr io.Writer) error {31if m.Command.CMD != cmd {32return errors.New("command not found")33}3435_, _ = stdout.Write(m.Command.STDOUT)36_, _ = stderr.Write(m.Command.STDERR)37return m.Command.Err38}394041