123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901 |
- /*
- Copyright 2014 The Kubernetes 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.
- */
- package kubectl
- import (
- "reflect"
- "testing"
- "k8s.io/kubernetes/pkg/api"
- "k8s.io/kubernetes/pkg/api/resource"
- "k8s.io/kubernetes/pkg/api/unversioned"
- "k8s.io/kubernetes/pkg/apis/batch"
- "k8s.io/kubernetes/pkg/apis/extensions"
- )
- func TestGenerate(t *testing.T) {
- tests := []struct {
- params map[string]interface{}
- expected *api.ReplicationController
- expectErr bool
- }{
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "image-pull-policy": "Always",
- "replicas": "1",
- "port": "-1",
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"run": "foo"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullAlways,
- },
- },
- },
- },
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "port": "-1",
- "env": []string{"a=b", "c=d"},
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"run": "foo"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- Env: []api.EnvVar{
- {
- Name: "a",
- Value: "b",
- },
- {
- Name: "c",
- Value: "d",
- },
- },
- },
- },
- },
- },
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "image-pull-policy": "Never",
- "replicas": "1",
- "port": "-1",
- "args": []string{"bar", "baz", "blah"},
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"run": "foo"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullNever,
- Args: []string{"bar", "baz", "blah"},
- },
- },
- },
- },
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "port": "-1",
- "args": []string{"bar", "baz", "blah"},
- "command": "true",
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"run": "foo"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- Command: []string{"bar", "baz", "blah"},
- },
- },
- },
- },
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "port": "80",
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"run": "foo"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- Ports: []api.ContainerPort{
- {
- ContainerPort: 80,
- },
- },
- },
- },
- },
- },
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "image-pull-policy": "IfNotPresent",
- "replicas": "1",
- "port": "80",
- "hostport": "80",
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"run": "foo"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"run": "foo"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullIfNotPresent,
- Ports: []api.ContainerPort{
- {
- ContainerPort: 80,
- HostPort: 80,
- },
- },
- },
- },
- },
- },
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "hostport": "80",
- },
- expected: nil,
- expectErr: true,
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"foo": "bar", "baz": "blah"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- },
- },
- },
- },
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "hostport": "80",
- },
- expected: nil,
- expectErr: true,
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- "requests": "cpu100m,memory=100Mi",
- },
- expected: nil,
- expectErr: true,
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- "requests": "cpu=100m&memory=100Mi",
- },
- expected: nil,
- expectErr: true,
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- "requests": "cpu=",
- },
- expected: nil,
- expectErr: true,
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- "requests": "cpu=100m,memory=100Mi",
- "limits": "cpu=400m,memory=200Mi",
- },
- expected: &api.ReplicationController{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.ReplicationControllerSpec{
- Replicas: 1,
- Selector: map[string]string{"foo": "bar", "baz": "blah"},
- Template: &api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- Resources: api.ResourceRequirements{
- Requests: api.ResourceList{
- api.ResourceCPU: resource.MustParse("100m"),
- api.ResourceMemory: resource.MustParse("100Mi"),
- },
- Limits: api.ResourceList{
- api.ResourceCPU: resource.MustParse("400m"),
- api.ResourceMemory: resource.MustParse("200Mi"),
- },
- },
- },
- },
- },
- },
- },
- },
- },
- }
- generator := BasicReplicationController{}
- for i, test := range tests {
- obj, err := generator.Generate(test.params)
- t.Logf("%d: %#v", i, obj)
- if !test.expectErr && err != nil {
- t.Errorf("unexpected error: %v", err)
- continue
- }
- if test.expectErr && err != nil {
- continue
- }
- if !reflect.DeepEqual(obj.(*api.ReplicationController).Spec.Template, test.expected.Spec.Template) {
- t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected.Spec.Template, obj.(*api.ReplicationController).Spec.Template)
- }
- }
- }
- func TestGeneratePod(t *testing.T) {
- tests := []struct {
- params map[string]interface{}
- expected *api.Pod
- expectErr bool
- }{
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "port": "-1",
- },
- expected: &api.Pod{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullIfNotPresent,
- },
- },
- DNSPolicy: api.DNSClusterFirst,
- RestartPolicy: api.RestartPolicyAlways,
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "env": []string{"a", "c"},
- },
- expected: nil,
- expectErr: true,
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "image-pull-policy": "Always",
- "env": []string{"a=b", "c=d"},
- },
- expected: &api.Pod{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullAlways,
- Env: []api.EnvVar{
- {
- Name: "a",
- Value: "b",
- },
- {
- Name: "c",
- Value: "d",
- },
- },
- },
- },
- DNSPolicy: api.DNSClusterFirst,
- RestartPolicy: api.RestartPolicyAlways,
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "port": "80",
- },
- expected: &api.Pod{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullIfNotPresent,
- Ports: []api.ContainerPort{
- {
- ContainerPort: 80,
- },
- },
- },
- },
- DNSPolicy: api.DNSClusterFirst,
- RestartPolicy: api.RestartPolicyAlways,
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "port": "80",
- "hostport": "80",
- },
- expected: &api.Pod{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullIfNotPresent,
- Ports: []api.ContainerPort{
- {
- ContainerPort: 80,
- HostPort: 80,
- },
- },
- },
- },
- DNSPolicy: api.DNSClusterFirst,
- RestartPolicy: api.RestartPolicyAlways,
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "hostport": "80",
- },
- expected: nil,
- expectErr: true,
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- },
- expected: &api.Pod{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullIfNotPresent,
- },
- },
- DNSPolicy: api.DNSClusterFirst,
- RestartPolicy: api.RestartPolicyAlways,
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- "stdin": "true",
- },
- expected: &api.Pod{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullIfNotPresent,
- Stdin: true,
- StdinOnce: true,
- },
- },
- DNSPolicy: api.DNSClusterFirst,
- RestartPolicy: api.RestartPolicyAlways,
- },
- },
- },
- {
- params: map[string]interface{}{
- "name": "foo",
- "image": "someimage",
- "replicas": "1",
- "labels": "foo=bar,baz=blah",
- "stdin": "true",
- "leave-stdin-open": "true",
- },
- expected: &api.Pod{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullIfNotPresent,
- Stdin: true,
- StdinOnce: false,
- },
- },
- DNSPolicy: api.DNSClusterFirst,
- RestartPolicy: api.RestartPolicyAlways,
- },
- },
- },
- }
- generator := BasicPod{}
- for _, test := range tests {
- obj, err := generator.Generate(test.params)
- if !test.expectErr && err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if test.expectErr && err != nil {
- continue
- }
- if !reflect.DeepEqual(obj.(*api.Pod), test.expected) {
- t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*api.Pod))
- }
- }
- }
- func TestGenerateDeployment(t *testing.T) {
- tests := []struct {
- params map[string]interface{}
- expected *extensions.Deployment
- expectErr bool
- }{
- {
- params: map[string]interface{}{
- "labels": "foo=bar,baz=blah",
- "name": "foo",
- "replicas": "3",
- "image": "someimage",
- "image-pull-policy": "Always",
- "port": "80",
- "hostport": "80",
- "stdin": "true",
- "command": "true",
- "args": []string{"bar", "baz", "blah"},
- "env": []string{"a=b", "c=d"},
- "requests": "cpu=100m,memory=100Mi",
- "limits": "cpu=400m,memory=200Mi",
- },
- expected: &extensions.Deployment{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: extensions.DeploymentSpec{
- Replicas: 3,
- Selector: &unversioned.LabelSelector{MatchLabels: map[string]string{"foo": "bar", "baz": "blah"}},
- Template: api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.PodSpec{
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- ImagePullPolicy: api.PullAlways,
- Stdin: true,
- Ports: []api.ContainerPort{
- {
- ContainerPort: 80,
- HostPort: 80,
- },
- },
- Command: []string{"bar", "baz", "blah"},
- Env: []api.EnvVar{
- {
- Name: "a",
- Value: "b",
- },
- {
- Name: "c",
- Value: "d",
- },
- },
- Resources: api.ResourceRequirements{
- Requests: api.ResourceList{
- api.ResourceCPU: resource.MustParse("100m"),
- api.ResourceMemory: resource.MustParse("100Mi"),
- },
- Limits: api.ResourceList{
- api.ResourceCPU: resource.MustParse("400m"),
- api.ResourceMemory: resource.MustParse("200Mi"),
- },
- },
- },
- },
- },
- },
- },
- },
- },
- }
- generator := DeploymentV1Beta1{}
- for _, test := range tests {
- obj, err := generator.Generate(test.params)
- if !test.expectErr && err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if test.expectErr && err != nil {
- continue
- }
- if !reflect.DeepEqual(obj.(*extensions.Deployment), test.expected) {
- t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*extensions.Deployment))
- }
- }
- }
- func TestGenerateJob(t *testing.T) {
- tests := []struct {
- params map[string]interface{}
- expected *batch.Job
- expectErr bool
- }{
- {
- params: map[string]interface{}{
- "labels": "foo=bar,baz=blah",
- "name": "foo",
- "image": "someimage",
- "port": "80",
- "hostport": "80",
- "stdin": "true",
- "leave-stdin-open": "true",
- "command": "true",
- "args": []string{"bar", "baz", "blah"},
- "env": []string{"a=b", "c=d"},
- "requests": "cpu=100m,memory=100Mi",
- "limits": "cpu=400m,memory=200Mi",
- "restart": "OnFailure",
- },
- expected: &batch.Job{
- ObjectMeta: api.ObjectMeta{
- Name: "foo",
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: batch.JobSpec{
- Selector: &unversioned.LabelSelector{
- MatchLabels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- ManualSelector: newBool(true),
- Template: api.PodTemplateSpec{
- ObjectMeta: api.ObjectMeta{
- Labels: map[string]string{"foo": "bar", "baz": "blah"},
- },
- Spec: api.PodSpec{
- RestartPolicy: api.RestartPolicyOnFailure,
- Containers: []api.Container{
- {
- Name: "foo",
- Image: "someimage",
- Stdin: true,
- StdinOnce: false,
- Ports: []api.ContainerPort{
- {
- ContainerPort: 80,
- HostPort: 80,
- },
- },
- Command: []string{"bar", "baz", "blah"},
- Env: []api.EnvVar{
- {
- Name: "a",
- Value: "b",
- },
- {
- Name: "c",
- Value: "d",
- },
- },
- Resources: api.ResourceRequirements{
- Requests: api.ResourceList{
- api.ResourceCPU: resource.MustParse("100m"),
- api.ResourceMemory: resource.MustParse("100Mi"),
- },
- Limits: api.ResourceList{
- api.ResourceCPU: resource.MustParse("400m"),
- api.ResourceMemory: resource.MustParse("200Mi"),
- },
- },
- },
- },
- },
- },
- },
- },
- },
- }
- generator := JobV1Beta1{}
- for _, test := range tests {
- obj, err := generator.Generate(test.params)
- if !test.expectErr && err != nil {
- t.Errorf("unexpected error: %v", err)
- }
- if test.expectErr && err != nil {
- continue
- }
- if !reflect.DeepEqual(obj.(*batch.Job), test.expected) {
- t.Errorf("\nexpected:\n%#v\nsaw:\n%#v", test.expected, obj.(*batch.Job))
- }
- }
- }
- func TestParseEnv(t *testing.T) {
- tests := []struct {
- envArray []string
- expected []api.EnvVar
- expectErr bool
- test string
- }{
- {
- envArray: []string{
- "THIS_ENV=isOK",
- "HAS_COMMAS=foo,bar",
- "HAS_EQUALS=jJnro54iUu75xNy==",
- },
- expected: []api.EnvVar{
- {
- Name: "THIS_ENV",
- Value: "isOK",
- },
- {
- Name: "HAS_COMMAS",
- Value: "foo,bar",
- },
- {
- Name: "HAS_EQUALS",
- Value: "jJnro54iUu75xNy==",
- },
- },
- expectErr: false,
- test: "test case 1",
- },
- {
- envArray: []string{
- "WITH_OUT_EQUALS",
- },
- expected: []api.EnvVar{},
- expectErr: true,
- test: "test case 2",
- },
- {
- envArray: []string{
- "WITH_OUT_VALUES=",
- },
- expected: []api.EnvVar{
- {
- Name: "WITH_OUT_VALUES",
- Value: "",
- },
- },
- expectErr: false,
- test: "test case 3",
- },
- {
- envArray: []string{
- "=WITH_OUT_NAME",
- },
- expected: []api.EnvVar{},
- expectErr: true,
- test: "test case 4",
- },
- }
- for _, test := range tests {
- envs, err := parseEnvs(test.envArray)
- if !test.expectErr && err != nil {
- t.Errorf("unexpected error: %v (%s)", err, test.test)
- }
- if test.expectErr && err != nil {
- continue
- }
- if !reflect.DeepEqual(envs, test.expected) {
- t.Errorf("\nexpected:\n%#v\nsaw:\n%#v (%s)", test.expected, envs, test.test)
- }
- }
- }
|