github.com/demonoid81/containerd@v1.3.4/snapshots/native/native_test.go (about)

     1  /*
     2     Copyright The containerd Authors.
     3  
     4     Licensed under the Apache License, Version 2.0 (the "License");
     5     you may not use this file except in compliance with the License.
     6     You may obtain a copy of the License at
     7  
     8         http://www.apache.org/licenses/LICENSE-2.0
     9  
    10     Unless required by applicable law or agreed to in writing, software
    11     distributed under the License is distributed on an "AS IS" BASIS,
    12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     See the License for the specific language governing permissions and
    14     limitations under the License.
    15  */
    16  
    17  package native
    18  
    19  import (
    20  	"context"
    21  	"runtime"
    22  	"testing"
    23  
    24  	"github.com/containerd/containerd/pkg/testutil"
    25  	"github.com/containerd/containerd/snapshots"
    26  	"github.com/containerd/containerd/snapshots/testsuite"
    27  )
    28  
    29  func newSnapshotter(ctx context.Context, root string) (snapshots.Snapshotter, func() error, error) {
    30  	snapshotter, err := NewSnapshotter(root)
    31  	if err != nil {
    32  		return nil, nil, err
    33  	}
    34  
    35  	return snapshotter, func() error { return snapshotter.Close() }, nil
    36  }
    37  
    38  func TestNaive(t *testing.T) {
    39  	if runtime.GOOS == "windows" {
    40  		t.Skip("snapshotter not implemented on windows")
    41  	}
    42  	testutil.RequiresRoot(t)
    43  	testsuite.SnapshotterSuite(t, "Naive", newSnapshotter)
    44  }