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

updates_test: do not rely on json as a string but compare the Rpc structure #182

Merged
merged 1 commit into from
Dec 11, 2017

Conversation

mseri
Copy link
Collaborator

@mseri mseri commented Dec 11, 2017

This fixes a test that broke after the latest rpc update.
The new json serialization drops unneeded characters (e.g. pretty print newlines and spaces),
so tests that are based on specific output strings can break without any real breakage.

In this case the failure was due to:

got ->      {"updates":[{"id":1,"v":"[\"Foo\",\"a\"]"}],"barriers":[[1,2,[{"id":1,"v":"[\"Foo\",\"a\"]"}]]]}
expected -> {"updates": [{"id": 1, "v": "[\"Foo\", \"a\"]"}], "barriers": [[1, 2, [{"id": 1, "v": "[\"Foo\", \"a\"]"}]]]}

The two json representations are matching but we were relying on the
wrong invariant.
This change makes the test more robust with respect to this kind of
changes, although still not perfect (the values of v are still json
strings).

Signed-off-by: Marcello Seri marcello.seri@citrix.com

…ucture

This fixes a test that broke after the latest rpc update.
The new json serialization drops unneeded characters (e.g. pretty print newlines and spaces),
so tests that are based on specific output strings can break without any real breakage.

In this case the failure was due to:
```
got ->      {"updates":[{"id":1,"v":"[\"Foo\",\"a\"]"}],"barriers":[[1,2,[{"id":1,"v":"[\"Foo\",\"a\"]"}]]]}
expected -> {"updates": [{"id": 1, "v": "[\"Foo\", \"a\"]"}], "barriers": [[1, 2, [{"id": 1, "v": "[\"Foo\", \"a\"]"}]]]}
```

The two json representations are matching but we were relying on the
wrong invariant.
This change makes the test more robust with respect to this kind of
changes, although still not perfect (the values of v are still json
strings).

Signed-off-by: Marcello Seri <marcello.seri@citrix.com>
@coveralls
Copy link

coveralls commented Dec 11, 2017

Coverage Status

Changes Unknown when pulling 583fbb0 on mseri:fix-test into ** on xapi-project:master**.

@edwintorok edwintorok merged commit 3799fd3 into xapi-project:master Dec 11, 2017
@mseri mseri deleted the fix-test branch December 11, 2017 16:33
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.

None yet

3 participants