This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overlay and multi-az for legacy Windows
- Loading branch information
Showing
7 changed files
with
338 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2022 VMware, Inc. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package unit | ||
|
||
import ( | ||
"io" | ||
"strings" | ||
|
||
"gopkg.in/yaml.v3" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
type yttValues map[string]interface{} | ||
|
||
func (v yttValues) toReader() io.Reader { | ||
return strings.NewReader(createDataValues(v)) | ||
} | ||
|
||
func (v yttValues) Set(key string, value interface{}) { | ||
v[key] = value | ||
} | ||
|
||
func (v yttValues) Delete(key string) { | ||
delete(v, key) | ||
} | ||
|
||
func (v yttValues) DeepCopy() yttValues { | ||
other := make(yttValues) | ||
for key, value := range v { | ||
other[key] = value | ||
} | ||
return other | ||
} | ||
|
||
func assertNotFound(docs []string, err error) { | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(docs).To(HaveLen(0)) | ||
} | ||
|
||
func assertFoundOne(docs []string, err error) { | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(docs).To(HaveLen(1)) | ||
} | ||
|
||
func createDataValues(values map[string]interface{}) string { | ||
dataValues := "#@data/values\n---\n" | ||
bytes, err := yaml.Marshal(values) | ||
if err != nil { | ||
return "" | ||
} | ||
valuesStr := string(bytes) | ||
valuesStr = strings.ReplaceAll(valuesStr, "\"true\"", "true") | ||
valuesStr = strings.ReplaceAll(valuesStr, "\"false\"", "false") | ||
return dataValues + valuesStr | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.