Signed-off-by: wujunwei <wjw3323@live.com>
pull/11551/head
wujunwei 3 years ago
parent b869a50056
commit 0521d9332c

@ -235,13 +235,13 @@ func matchFilePatterns(target string, sf []string) bool {
func writeManifest(outputDir, path, manifest string, fileWritten map[string]bool, withHeader bool, outStream io.Writer) error {
if outputDir == "" {
return writeStream(path, manifest, withHeader, outStream)
} else {
err := writeToFile(outputDir, path, manifest, fileWritten[path], withHeader)
if err != nil {
return err
}
fileWritten[path] = true
}
err := writeToFile(outputDir, path, manifest, fileWritten[path], withHeader)
if err != nil {
return err
}
fileWritten[path] = true
return nil
}

@ -18,10 +18,11 @@ package main
import (
"fmt"
"github.com/stretchr/testify/assert"
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
)
var chartPath = "testdata/testcharts/subchart"

@ -5,7 +5,7 @@ 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
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,
@ -76,32 +76,6 @@ var manifestWithTestHook = `kind: Pod
cmd: fake-command
`
var rbacManifests = `apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: schedule-agents
rules:
- apiGroups: [""]
resources: ["pods", "pods/exec", "pods/log"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: schedule-agents
namespace: {{ default .Release.Namespace}}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: schedule-agents
subjects:
- kind: ServiceAccount
name: schedule-agents
namespace: {{ .Release.Namespace }}
`
type chartOptions struct {
*chart.Chart
}
@ -209,15 +183,6 @@ func withSampleIncludingIncorrectTemplates() chartOption {
}
}
func withMultipleManifestTemplate() chartOption {
return func(opts *chartOptions) {
sampleTemplates := []*chart.File{
{Name: "templates/rbac", Data: []byte(rbacManifests)},
}
opts.Templates = append(opts.Templates, sampleTemplates...)
}
}
func withKube(version string) chartOption {
return func(opts *chartOptions) {
opts.Metadata.KubeVersion = version

Loading…
Cancel
Save