Skip to content

Commit

Permalink
Add resourceVersion in the dummy object so that referencing metadata.…
Browse files Browse the repository at this point in the history
…resourceVersion does not throw an error when validating the RGD.

fixes #300
  • Loading branch information
barney-s committed Feb 12, 2025
1 parent 7ea746c commit d205c34
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/graph/emulator/emulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ func NewEmulator() *Emulator {
}

// GenerateDummyCR generates a dummy CR based on the provided schema.
func (e *Emulator) GenerateDummyCR(gvk schema.GroupVersionKind, schema *spec.Schema) (*unstructured.Unstructured, error) {
func (e *Emulator) GenerateDummyCR(gvk schema.GroupVersionKind,
schema *spec.Schema) (*unstructured.Unstructured, error) {
if schema == nil {
return nil, fmt.Errorf("schema is nil for %v", gvk)
}
Expand All @@ -70,6 +71,7 @@ func (e *Emulator) GenerateDummyCR(gvk schema.GroupVersionKind, schema *spec.Sch
cr.SetKind(gvk.Kind)
cr.SetName(fmt.Sprintf("%s-sample", strings.ToLower(gvk.Kind)))
cr.SetNamespace("default")
cr.SetResourceVersion(fmt.Sprintf("%d", e.rand.Intn(1000)))
return cr, nil
}

Expand Down

0 comments on commit d205c34

Please sign in to comment.