MCPcopy
hub / github.com/operator-framework/operator-sdk / writeCSV

Function writeCSV

test/integration/suite_test.go:181–197  ·  view source on GitHub ↗
(tc *testutils.TestContext, version string, csv *v1alpha1.ClusterServiceVersion, isBundle bool)

Source from the content-addressed store, hash-verified

179}
180
181func writeCSV(tc *testutils.TestContext, version string, csv *v1alpha1.ClusterServiceVersion, isBundle bool) error {
182 b, err := yaml.Marshal(csv)
183 if err != nil {
184 return err
185 }
186 f, err := os.OpenFile(csvPath(tc, version, isBundle), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
187 if err != nil {
188 return err
189 }
190 if _, err := f.Write(b); err != nil {
191 return err
192 }
193 if err := f.Sync(); err != nil {
194 return err
195 }
196 return f.Close()
197}
198
199func csvPath(tc *testutils.TestContext, version string, isBundle bool) string {
200 fileName := fmt.Sprintf("%s.clusterserviceversion.yaml", tc.ProjectName)

Callers 1

suite_test.goFile · 0.85

Calls 4

csvPathFunction · 0.85
MarshalMethod · 0.80
WriteMethod · 0.80
SyncMethod · 0.65

Tested by

no test coverage detected