Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Add integration test demonstrating use of PersistentVolumeClaims for inter-build caching #228

Closed
wants to merge 1 commit into from
Closed
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
23 changes: 23 additions & 0 deletions tests/cache-volume/0-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2018 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: build-cache-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
33 changes: 33 additions & 0 deletions tests/cache-volume/1-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2018 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
apiVersion: build.knative.dev/v1alpha1
kind: Build
metadata:
name: test-cache-volume-1
labels:
expect: succeeded
spec:
steps:
# Populate the persistent volume with some content.
- name: populate-cache
image: ubuntu
command: ['bash']
args: ['-c', 'echo hello > /cache/foo']
volumeMounts:
- name: build-cache
mountPath: /cache
volumes:
- name: build-cache
persistentVolumeClaim:
claimName: build-cache-claim
34 changes: 34 additions & 0 deletions tests/cache-volume/2-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2018 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License 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.
apiVersion: build.knative.dev/v1alpha1
kind: Build
metadata:
name: test-cache-volume-2
labels:
expect: succeeded
spec:
steps:
# Check that the persistent volume contains the content produced by the
# previous build.
- name: cache-populated
image: ubuntu
command: ['bash']
args: ['-c', '[[ $(cat /cache/foo) == "hello" ]]']
volumeMounts:
- name: build-cache
mountPath: /cache
volumes:
- name: build-cache
persistentVolumeClaim:
claimName: build-cache-claim