(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestMemoryCache_PutArtifact(t *testing.T) { |
| 15 | tests := []struct { |
| 16 | name string |
| 17 | artifactID string |
| 18 | artifactInfo types.ArtifactInfo |
| 19 | }{ |
| 20 | { |
| 21 | name: "happy path", |
| 22 | artifactID: "sha256:8652b9f0cb4c0599575e5a003f5906876e10c1ceb2ab9fe1786712dac14a50cf", |
| 23 | artifactInfo: types.ArtifactInfo{ |
| 24 | SchemaVersion: 2, |
| 25 | Architecture: "amd64", |
| 26 | Created: time.Date(2020, 11, 14, 0, 20, 4, 0, time.UTC), |
| 27 | DockerVersion: "19.03.12", |
| 28 | OS: "linux", |
| 29 | }, |
| 30 | }, |
| 31 | } |
| 32 | |
| 33 | for _, tt := range tests { |
| 34 | t.Run(tt.name, func(t *testing.T) { |
| 35 | c := cache.NewMemoryCache() |
| 36 | |
| 37 | err := c.PutArtifact(t.Context(), tt.artifactID, tt.artifactInfo) |
| 38 | require.NoError(t, err) |
| 39 | |
| 40 | got, err := c.GetArtifact(t.Context(), tt.artifactID) |
| 41 | require.NoError(t, err) |
| 42 | assert.Equal(t, tt.artifactInfo, got) |
| 43 | }) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | func TestMemoryCache_PutBlob(t *testing.T) { |
| 48 | tests := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…