Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may
# not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file 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.


build:
script:
- make

test-snapshotter-nonroot:
script:
- cd snapshotter && DISABLE_ROOT_TESTS='true' make test EXTRAGOARGS='-v -count=1'

test-snapshotter-root:
script:
- cd snapshotter && sudo make test EXTRAGOARGS='-v -count=1'
3 changes: 2 additions & 1 deletion snapshotter/naive/naive.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
imageDirName = "images"
imageFSType = "ext4"
sparseImageSizeMB = 1024
mib = 1048576
)

// Snapshotter implements naive snapshotter for containerd
Expand Down Expand Up @@ -302,7 +303,7 @@ func (s *Snapshotter) createImage(ctx context.Context, imagePath string, fileSiz
return err
}

if err := file.Truncate(int64(fileSizeMB) * 1048576); err != nil {
if err := file.Truncate(int64(fileSizeMB) * mib); err != nil {
return err
}

Expand Down
6 changes: 3 additions & 3 deletions snapshotter/naive/naive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func TestCreateImage(t *testing.T) {
imgPath := filepath.Join(tempDir, "x.img")

const (
sizeMB = 100
sizeBytes = sizeMB * 100000
sizeMiB = 100
sizeBytes = sizeMiB * mib
)

err = snap.createImage(context.Background(), imgPath, sizeMB)
err = snap.createImage(context.Background(), imgPath, sizeMiB)
if err != nil {
t.Fatal(err)
}
Expand Down