Skip to content

Commit

Permalink
Add replace patch strategy for DockerImageMetadata and cmd tests for …
Browse files Browse the repository at this point in the history
…oc edit istag
  • Loading branch information
soltysh committed Feb 8, 2017
1 parent 481a126 commit e208952
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/image/api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Image struct {
// DockerImageReference is the string that can be used to pull this image.
DockerImageReference string `json:"dockerImageReference,omitempty" protobuf:"bytes,2,opt,name=dockerImageReference"`
// DockerImageMetadata contains metadata about this image
DockerImageMetadata runtime.RawExtension `json:"dockerImageMetadata,omitempty" protobuf:"bytes,3,opt,name=dockerImageMetadata"`
DockerImageMetadata runtime.RawExtension `json:"dockerImageMetadata,omitempty" patchStrategy:"replace" protobuf:"bytes,3,opt,name=dockerImageMetadata"`
// DockerImageMetadataVersion conveys the version of the object, which if empty defaults to "1.0"
DockerImageMetadataVersion string `json:"dockerImageMetadataVersion,omitempty" protobuf:"bytes,4,opt,name=dockerImageMetadataVersion"`
// DockerImageManifest is the raw JSON of the manifest
Expand Down
12 changes: 12 additions & 0 deletions test/cmd/edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,17 @@ os::cmd::expect_success_and_not_text 'OC_EDITOR=cat oc edit --windows-line-endin

os::cmd::expect_success 'oc create -f test/testdata/services.yaml'
os::cmd::expect_success_and_text 'OC_EDITOR=cat oc edit svc' 'kind: List'

os::cmd::expect_success 'oc create imagestream test'
os::cmd::expect_success 'oc create -f test/testdata/mysql-image-stream-mapping.yaml'
os::cmd::expect_success_and_not_text 'oc get istag/test:new -o jsonpath={.metadata.annotations}' "tags:hidden"
editorfile="$(mktemp -d)/tmp-editor.sh"
echo '#!/bin/bash' > ${editorfile}
echo 'sed -i "s/^tag: null/tag:\n referencePolicy:\n type: Source/g" $1' >> ${editorfile}
echo 'sed -i "s/^metadata:$/metadata:\n annotations:\n tags: hidden/g" $1' >> ${editorfile}
chmod +x ${editorfile}
os::cmd::expect_success "EDITOR=${editorfile} oc edit istag/test:new"
os::cmd::expect_success_and_text 'oc get istag/test:new -o jsonpath={.metadata.annotations}' "tags:hidden"

echo "edit: ok"
os::test::junit::declare_suite_end

0 comments on commit e208952

Please sign in to comment.