capactio / capact

Simple way to manage applications and infrastructure.
https://capact.io
Apache License 2.0
80 stars 19 forks source link

Integration tests randomly fail on `creates multiple TypeInstances with uses relations` step #640

Closed pkosiec closed 2 years ago

pkosiec commented 2 years ago

Description

The TypeInstance assertions in test/e2e/hub_test.go:341 are problematic:

assertTypeInstance(ctx, cli, *childTiID, expectedChild)
assertTypeInstance(ctx, cli, *parentTiID, expectedParent)`

They check exact equality of TypeInstances, but the uses and usedBy field can contain different order of TypeInstances. That causes the integration tests to fail

Options

The options we should consider:

  1. sort related TypeInstances in the uses and usedBy
  2. update test to ignore the order of TypeInstances in relation
    • The easiest and fastest solution for now - but eventually it would be good to have our resources sorted for our API

Full error

https://github.com/capactio/capact/runs/5245477683?check_suite_focus=true

GraphQL API Local Hub 
  creates multiple TypeInstances with uses relations
  /capact.io/capact/test/e2e/hub_test.go:317

• Failure [3.397 seconds]
GraphQL API
/capact.io/capact/test/e2e/hub_test.go:24
  Local Hub
  /capact.io/capact/test/e2e/hub_test.go:246
    creates multiple TypeInstances with uses relations [It]
    /capact.io/capact/test/e2e/hub_test.go:317

    Expected
        <graphql.TypeInstance>: {
            ID: "4fc04b89-24b9-4c1d-b6a6-6b69f17764dc",
            LockedBy: nil,
            TypeRef: {Path: "com.parent", Revision: "0.1.0"},
            Uses: [
                {
                    ID: "c8ca22c4-4978-4dec-8742-c17300e9c7f0",
                    LockedBy: nil,
                    TypeRef: {Path: "com.child", Revision: "0.1.0"},
                    Uses: nil,
                    UsedBy: nil,
                    Backend: {
                        ID: "318b99bd-9b26-4bc1-8259-0a7ff5dae61c",
                        Abstract: true,
                    },
                    LatestResourceVersion: {
                        ResourceVersion: 1,
                        CreatedBy: nil,
                        Metadata: {
                            Attributes: [
                                {Path: "com.attr", Revision: "0.1.0"},
                            ],
                        },
                        Spec: {
                            Value: <map[string]interface {} | len:1>{"child": <bool>true},
                                    "acceptValue": <bool>false,
                                    "contextSchema": nil,
                                },
                                Instrumentation: nil,
                            },
                        },
                    ],
                },
                {
                    ID: "c8ca22c4-4978-4dec-8742-c17300e9c7f0",
                    LockedBy: nil,
                    TypeRef: {Path: "com.child", Revision: "0.1.0"},
                    Uses: nil,
                    UsedBy: nil,
                    Backend: {
                        ID: "318b99bd-9b26-4bc1-8259-0a7ff5dae61c",
                        Abstract: true,
                    },
                    LatestResourceVersion: {
                        ResourceVersion: 1,
                        CreatedBy: nil,
                        Metadata: {
                            Attributes: [
Error: pod capact-test-e2e failed
                                {Path: "com.attr", Revision: "0.1.0"},
                            ],
                        },
                        Spec: {
                            Value: <map[string]interface {} | len:1>{"child": <bool>true},
                            Instrumentation: nil,
                        },
                    },
                    FirstResourceVersion: {
                        ResourceVersion: 1,
                        CreatedBy: nil,
                        Metadata: {
                            Attributes: [
                                {Path: "com.attr", Revision: "0.1.0"},
                            ],
                        },
                        Spec: {
                            Value: <map[string]interface {} | len:1>{"child": <bool>true},
                            Instrumen...

    Gomega truncated this representation as it exceeds 'format.MaxLength'.
    Consider having the object provide a custom 'GomegaStringer' representation
    or adjust the parameters in Gomega's 'format' package.

    Learn more here: https://onsi.github.io/gomega/#adjusting-output

    /capact.io/capact/test/e2e/hub_test.go:668