Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(framework): fixed param/meta comparison for duplicate resource def with the same id #34

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

astromechza
Copy link
Member

While upgrading a Score implementation at Humanitec I found a bug when processing a spec like the following (which was used in an existing unit test):

...
resources:
  thing-a:
    type: cat
    id: garfield
    params:
      color: orange
  thing-b:
    type: cat
    id: garfield
    params:
      color: orange 

This is an esoteric example which makes more sense when looking at multiple score workloads that define the same resource in the same project. The current main branch check was failing because deep-equal returned false because the metadata dictionaries were technically not the same outer type at the time of comparison.

The fix is just coercing it to the comparable type map[string]interface{}.

Specs like this (params or metadata defined only once) will still work fine without errors.

  thing-a:
    type: cat
    id: garfield
    params:
      color: orange
  thing-b:
    type: cat
    id: garfield

@astromechza astromechza merged commit aeeb881 into main Apr 8, 2024
2 checks passed
@astromechza astromechza deleted the fix-same-param-comparisons branch April 8, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants