Path: blob/main/test/tests/components/ws-daemon/fuse_device_test.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 wsdaemon56import (7"context"8"testing"9"time"1011"github.com/gitpod-io/gitpod/test/pkg/integration"12"sigs.k8s.io/e2e-framework/pkg/envconf"13"sigs.k8s.io/e2e-framework/pkg/features"14)1516func TestFuseDevice(t *testing.T) {17f := features.New("fuse devive").18WithLabel("component", "ws-daemon").19Assess("verify fuse device", func(testCtx context.Context, t *testing.T, cfg *envconf.Config) context.Context {20t.Parallel()2122ctx, cancel := context.WithTimeout(testCtx, 5*time.Minute)23defer cancel()2425api := integration.NewComponentAPI(ctx, cfg.Namespace(), kubeconfig, cfg.Client())26t.Cleanup(func() {27api.Done(t)28})2930ws, stopWs, err := integration.LaunchWorkspaceDirectly(t, ctx, api)31if err != nil {32t.Fatal(err)33}34t.Cleanup(func() {35sctx, scancel := context.WithTimeout(context.Background(), 5*time.Minute)36defer scancel()3738sapi := integration.NewComponentAPI(sctx, cfg.Namespace(), kubeconfig, cfg.Client())39defer sapi.Done(t)4041_, err = stopWs(true, sapi)42if err != nil {43t.Fatal(err)44}45})4647rsa, closer, err := integration.Instrument(integration.ComponentWorkspace, "workspace", cfg.Namespace(), kubeconfig, cfg.Client(), integration.WithInstanceID(ws.Req.Id))48if err != nil {49t.Fatalf("unexpected error instrumenting workspace: %v", err)50}51defer rsa.Close()52integration.DeferCloser(t, closer)5354t.Logf("checking fuse device")55hasFuse, err := integration.HasFuseDevice(rsa)56if err != nil {57t.Fatalf("unexpected error checking fuse device: %v", err)58}59if !hasFuse {60t.Fatalf("fuse device is not available: %v", err)61}6263return testCtx64}).Feature()6566testEnv.Test(t, f)67}686970