-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Firestore: conformance tests hiding failures #6290
Comments
See #6290. Use 'pytest.mark.parametrize' to create a testcase per textproto file. Note that a *bunch* of them fail. :(
The cross platform test cases - especially those that only verify that an error has thrown - are not a replacement for unit tests. There are a very helpful tool when it comes to ensuring API conformance, but even without these tests, we should aim for high test coverage. |
@schmidt-sebastian: we do have good test coverage, but the failures masked by this bug are cases where our tests are asserting wrong behavior. Edit: I just checked, and we have 100% unit test coverage (including branches) even with the conformance tests not running. |
At least some subset of the failures are related to the decision to not pass "options" to document.set, instead electing to pass a merge boolean, which was an API change I guess. This is a problem because some set tests pass options in cases where merge is true and those options get ignored. This is the commit that introduced the API change: |
Here's sample failure output from the conformance tests demonstrating this (via set-17.testproto). Note that the expected "update mask" and payload is only "a" but the actual update mask and payload contain both "a" and "b". This is because set-17.testproto contains a "fields: a" option that gets ignored.
|
See some discussion of the |
Good find. It looks like the decision to use a merge= boolean instead of a MergeOption was cosmetic. I suspect we should just revert 421efcd but I'm not sure how an API change like this should be shepherded. |
It's not quite as simple as reverting the effect of that commit, unfortunately. I think I understand now why the commit was applied. Various methods of DocumentReference accept an "option" argument. An option is a "write option", which is an instance of a class that inherits from a common base class. These are supplied only on write ops like set and update. The state of the code prior to the commit attempted to characterize a merge as an option, but only one type of option may be supplied to any of the methods (there are other types of options such as an exists option, and a last_update option). This wasn't a problem in the past, because there were only two options previously (exists and last_update) and they were mutually exclusive. However, with the introduction of merge as an option, I think it broke the "all options are mutually exclusive from one another" assumption that had been in effect until then. This is evidenced by e.g. https://github.com/googleapis/google-cloud-python/blob/master/firestore/google/cloud/firestore_v1beta1/_helpers.py#L930 where it was changed to accept two arguments, exists and merge, which had each once been options; that code duplicates for "exists" what the client.ExistsOption.modify_write method is doing, doing an end run around the options system entirely. So I think we either need to:
I am partial to the first option. |
Please follow the APIs as outlined in the specification and as implemented by the other SDKs. Set - the Protobuf contains only Please take a look at the reference implementation in Node or in Java if there are any concerns. |
For the record, and in case anyone but me works on this: I assumed the This means means that it wasn't just the MergeOption commit which broke "set" tests (however, never reporting the breakage). It turns out that the |
@mcdonc Nice to meet you. As you mentioned here, I decided to design to pass "merge=True" to try to be similar to the node implementation here and here Digging through my commits, this does pass all 83 conformance tests at the time. However, I either must have squashed the wrong branch onto this or as I was implementing the MergeOption, I must have inadvertently broke tests. For the firestore team, especially @schmidt-sebastian @jba I am deeply sorry about any inconvenience I may have caused and I regretfully ended this badly in my last week. However, it was an honest mistake and I did not intend to claim that I passed the conformance test when I had not. I am willing to fix this if I can coordinate with @mcdonc and @tseaver. |
@mcdonc @tseaver To whomever is working on this, I am fairly certain I had squashed the wrong branch because the structure here from after passing the conformance tests at the time is different than what I had ended up with in the master branch. My current branch is failing 4 of the tests at the time, but it is probably the direction I had intended to go as I tried to do away with the option. It does seem like I need more info than a boolean in I am by no means finished, and I will look at it more when I could, but feel free to reach out to me if I can be of help. |
See #6290. Use 'pytest.mark.parametrize' to create a testcase per textproto file. Note that a *bunch* of them fail. :(
See #6290. Use 'pytest.mark.parametrize' to create a testcase per textproto file. Note that a *bunch* of them fail. :(
See #6290. Use 'pytest.mark.parametrize' to create a testcase per textproto file. Note that a *bunch* of them fail. :(
See #6290. Use 'pytest.mark.parametrize' to create a testcase per textproto file. Note that a *bunch* of them fail. :(
Since dd4b646 (PR #4851), the
test_cross_language
testcase has been swallowing errors.And therefore we have a bunch of bugs to fix. :(
The text was updated successfully, but these errors were encountered: