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

[Draft] Fix local state bug #14

Open
wants to merge 1 commit into
base: kalilsn/add-missing-param
Choose a base branch
from

Conversation

kalilsn
Copy link

@kalilsn kalilsn commented Jul 23, 2019

If you run the integration tests against this branch you'll see the following output:

Test output
FAIL  test-integration/config.test.js
  ● should apply service-route.example.yml

    expect(received).toEqual(expected) // deep equality

    - Expected
    + Received

    @@ -68,10 +68,34 @@
                  "regex_priority": 0,
                  "strip_path": true,
                },
                "id": "d490b0f0-5ebf-4c5a-817f-ba6fe7842bdb",
                "name": "d490b0f0-5ebf-4c5a-817f-ba6fe7842bdb",
    +           "plugins": Array [],
    +         },
    +         Object {
    +           "_info": Object {
    +             "created_at": 1563910208,
    +             "id": "d490b0f0-5ebf-4c5a-817f-ba6fe7842bdb",
    +             "updated_at": 1563910208,
    +           },
    +           "attributes": Object {
    +             "hosts": null,
    +             "methods": null,
    +             "paths": Array [
    +               "/mockbin",
    +             ],
    +             "preserve_host": false,
    +             "protocols": Array [
    +               "http",
    +               "https",
    +             ],
    +             "regex_priority": 0,
    +             "strip_path": true,
    +           },
    +           "id": "d490b0f0-5ebf-4c5a-817f-ba6fe7842bdb",
    +           "name": "d490b0f0-5ebf-4c5a-817f-ba6fe7842bdb",
                "plugins": Array [
                  Object {
                    "_info": Object {
                      "consumer_id": undefined,
                      "created_at": 1563910208000,

      83 |         expect(getLog()).toMatchSnapshot();
      84 |         expect(exportToYaml(ignoreKeys(kongState))).toMatchSnapshot();
    > 85 |         expect(ignoreConfigOrder(fixRouteNames(getLocalState()))).toEqual(addRouteNullKeys(kongState));
         |                                                                   ^
      86 |     });
      87 | });
      88 |

      at Object.toEqual (test-integration/config.test.js:85:67)


The line it's failing at tests whether the kong state as gathered by sending requests to the admin API matches the "local" state. Local state is determined from the log of API responses throughout kongfig's run – it's basically a caching solution. The test failure shows that the local state contains a duplicate copy of the route, which isn't present in the nonlocal state.

I previously encountered an error (that I think is related) where kongfig apply would fail to update the config file with a newly created route id, because the route wasn't present in the final state returned (it was missing here). I previously thought that was happening when creating that route was the last action taken. I'm no longer sure that's the case! Regardless, something is wrong with the state handling.

It's also worth noting that disabling the "experimental" local state feature is broken.

@kalilsn kalilsn changed the title Fix local state bug [Draft] Fix local state bug Jul 23, 2019
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.

1 participant