aboutsummaryrefslogtreecommitdiffstats
path: root/tests/integration/api_packages_container_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration/api_packages_container_test.go')
-rw-r--r--tests/integration/api_packages_container_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/integration/api_packages_container_test.go b/tests/integration/api_packages_container_test.go
index b2db77685d..9cdd84d5ee 100644
--- a/tests/integration/api_packages_container_test.go
+++ b/tests/integration/api_packages_container_test.go
@@ -7,6 +7,7 @@ import (
"bytes"
"crypto/sha256"
"encoding/base64"
+ "encoding/hex"
"fmt"
"net/http"
"strconv"
@@ -623,6 +624,22 @@ func TestPackageContainer(t *testing.T) {
assert.Equal(t, blobContent, resp.Body.Bytes())
})
+ t.Run("GetBlob/Empty", func(t *testing.T) {
+ defer tests.PrintCurrentTest(t)()
+ emptyDigestBuf := sha256.Sum256(nil)
+ emptyDigest := "sha256:" + hex.EncodeToString(emptyDigestBuf[:])
+ req := NewRequestWithBody(t, "POST", fmt.Sprintf("%s/blobs/uploads?digest=%s", url, emptyDigest), strings.NewReader("")).AddTokenAuth(userToken)
+ MakeRequest(t, req, http.StatusCreated)
+
+ req = NewRequest(t, "HEAD", fmt.Sprintf("%s/blobs/%s", url, emptyDigest)).AddTokenAuth(userToken)
+ resp := MakeRequest(t, req, http.StatusOK)
+ assert.Equal(t, "0", resp.Header().Get("Content-Length"))
+
+ req = NewRequest(t, "GET", fmt.Sprintf("%s/blobs/%s", url, emptyDigest)).AddTokenAuth(userToken)
+ resp = MakeRequest(t, req, http.StatusOK)
+ assert.Equal(t, "0", resp.Header().Get("Content-Length"))
+ })
+
t.Run("GetTagList", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()