Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo committed Feb 24, 2018
1 parent 98f27eb commit 6c7059f
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/oc/cli/describe/projectstatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,32 @@ func TestProjectStatus(t *testing.T) {
},
Time: mustParseTime("2016-04-07T04:12:25Z"),
},
"standalone daemonset": {
File: "rollingupdate-daemonset.yaml",
Extra: []runtime.Object{
&projectapi.Project{
ObjectMeta: metav1.ObjectMeta{Name: "example", Namespace: ""},
},
},
ErrFn: func(err error) bool { return err == nil },
Contains: []string{
"daemonset/bind manages gcr.io/google-containers/pause:2.0",
"generation #0 running for about a minute",
},
Time: mustParseTime("2016-04-07T04:12:25Z"),
},
"hpa non-missing scaleref": {
File: "hpa-with-scale-ref.yaml",
Extra: []runtime.Object{
&projectapi.Project{
ObjectMeta: metav1.ObjectMeta{Name: "example", Namespace: ""},
},
},
ErrFn: func(err error) bool { return err == nil },
Contains: []string{
"deployment/ruby-deploy deploys istag/ruby-deploy:latest",
},
},
}
oldTimeFn := timeNowFn
defer func() { timeNowFn = oldTimeFn }()
Expand Down
83 changes: 83 additions & 0 deletions pkg/oc/graph/genericgraph/test/hpa-with-scale-ref.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: v1
items:
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"ruby-deploy:latest"},"fieldPath":"spec.template.spec.containers[?(@.name==\"ruby-deploy\")].image"}]'
openshift.io/generated-by: OpenShiftNewApp
generation: 1
labels:
app: ruby-deploy
name: ruby-deploy
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: ruby-deploy
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: ruby-deploy
spec:
containers:
- image: busybox@sha256:4cee1979ba0bf7db9fc5d28fb7b798ca69ae95a47c5fecf46327720df4ff352d
imagePullPolicy: IfNotPresent
name: ruby-deploy
ports:
- containerPort: 8080
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
conditions:
- lastTransitionTime: 2018-02-24T00:51:47Z
lastUpdateTime: 2018-02-24T00:51:47Z
message: Deployment does not have minimum availability.
reason: MinimumReplicasUnavailable
status: "False"
type: Available
- lastTransitionTime: 2018-02-24T00:51:47Z
lastUpdateTime: 2018-02-24T00:51:47Z
message: ReplicaSet "ruby-deploy-599994c49b" is progressing.
reason: ReplicaSetUpdated
status: "True"
type: Progressing
observedGeneration: 1
replicas: 1
unavailableReplicas: 1
updatedReplicas: 1
- apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: ruby-deploy
spec:
maxReplicas: 1
minReplicas: 1
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: ruby-deploy
targetCPUUtilizationPercentage: 80
status:
currentReplicas: 0
desiredReplicas: 0
kind: List
metadata:
resourceVersion: ""
selfLink: ""
28 changes: 28 additions & 0 deletions pkg/oc/graph/genericgraph/test/rollingupdate-daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: bind
creationTimestamp: 2016-04-07T04:11:25Z
spec:
updateStrategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 10%
template:
metadata:
labels:
service: bind
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "service"
operator: "In"
values: ["bind"]
topologyKey: "kubernetes.io/hostname"
namespaces: []
containers:
- name: kubernetes-pause
image: gcr.io/google-containers/pause:2.0

0 comments on commit 6c7059f

Please sign in to comment.