mirror of https://github.com/helm/helm
This includes a substantial bit of unit test improvements. Also, in order to allow us to tests command line args (which translate to helm.Option objects), I had to add a new interface to pkg/helm.pull/955/head
parent
ed5be30acc
commit
a42b43a9fa
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func TestInstall(t *testing.T) {
|
||||
tests := []releaseCase{
|
||||
// Install, base case
|
||||
{
|
||||
name: "basic install",
|
||||
args: []string{"testdata/testcharts/alpine"},
|
||||
flags: strings.Split("--name aeneas", " "),
|
||||
expected: "aeneas",
|
||||
resp: releaseMock("aeneas"),
|
||||
},
|
||||
// Install, no hooks
|
||||
{
|
||||
name: "install without hooks",
|
||||
args: []string{"testdata/testcharts/alpine"},
|
||||
flags: strings.Split("--name aeneas --no-hooks", " "),
|
||||
expected: "juno",
|
||||
resp: releaseMock("juno"),
|
||||
},
|
||||
// Install, no charts
|
||||
{
|
||||
name: "install with no chart specified",
|
||||
args: []string{},
|
||||
err: true,
|
||||
},
|
||||
}
|
||||
|
||||
runReleaseCases(t, tests, func(c *fakeReleaseClient, out io.Writer) *cobra.Command {
|
||||
return newInstallCmd(c, out)
|
||||
})
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
name: alpine
|
||||
description: Deploy a basic Alpine Linux pod
|
||||
version: 0.1.0
|
||||
home: https://k8s.io/helm
|
||||
sources:
|
||||
- https://github.com/kubernetes/helm
|
@ -0,0 +1,13 @@
|
||||
#Alpine: A simple Helm chart
|
||||
|
||||
Run a single pod of Alpine Linux.
|
||||
|
||||
This example was generated using the command `helm create alpine`.
|
||||
|
||||
The `templates/` directory contains a very simple pod resource with a
|
||||
couple of parameters.
|
||||
|
||||
The `values.yaml` file contains the default values for the
|
||||
`alpine-pod.yaml` template.
|
||||
|
||||
You can install this example using `helm install docs/examples/alpine`.
|
@ -0,0 +1,26 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: "{{.Release.Name}}-{{.Values.Name}}"
|
||||
labels:
|
||||
# The "heritage" label is used to track which tool deployed a given chart.
|
||||
# It is useful for admins who want to see what releases a particular tool
|
||||
# is responsible for.
|
||||
heritage: {{.Release.Service | quote }}
|
||||
# The "release" convention makes it easy to tie a release to all of the
|
||||
# Kubernetes resources that were created as part of that release.
|
||||
release: {{.Release.Name | quote }}
|
||||
# This makes it easy to audit chart usage.
|
||||
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||
annotations:
|
||||
"helm.sh/created": {{.Release.Time.Seconds | quote }}
|
||||
spec:
|
||||
# This shows how to use a simple value. This will look for a passed-in value
|
||||
# called restartPolicy. If it is not found, it will use the default value.
|
||||
# {{default "Never" .restartPolicy}} is a slightly optimized version of the
|
||||
# more conventional syntax: {{.restartPolicy | default "Never"}}
|
||||
restartPolicy: {{default "Never" .Values.restartPolicy}}
|
||||
containers:
|
||||
- name: waiter
|
||||
image: "alpine:3.3"
|
||||
command: ["/bin/sleep","9000"]
|
@ -0,0 +1,2 @@
|
||||
# The pod name
|
||||
Name: my-alpine
|
Loading…
Reference in new issue