Commit Graph

406 Commits

Author SHA1 Message Date
Rakesh Emmadi
181902cc6c fix absence of "args" input field omits session variable argument, fix #3576 (#3585) 2019-12-26 16:32:48 -06:00
nizar-m
1fca7591c1 Show request id on test failures (#3556)
Right now on errors, only the expected and the actual responses are
shown. The actual response sometimes may not have all the information,
and you may have to look at the logs. In this case, request id would be
of great help to get the extra information from the logs.
2019-12-24 21:35:32 -06:00
Brandon Simmons
1e161d2ed1 Initial benchmarks for caching. Closes #3530
These aren't suitable e.g. for running in CI since some take far too
long (and an impossibly long-time when running under criterion's normal
bootstrapping sampling regime.

We might try to improve this ourselves:
 https://github.com/bos/criterion/issues/218

An initial summary analysis will be in #3530.
2019-12-20 10:10:07 -06:00
Brandon Simmons
5ca654dc0d Fix Hasura.Cache.Bounded.mkCacheSize to make sure we don't silently wrap or accept 0 2019-12-20 10:09:06 -06:00
Brandon Simmons
3f848a5c05 Fix unnecessary conditional logic in cache implementations 2019-12-20 10:09:06 -06:00
Phil Freeman
c766881125 Support batched queries (fix #1812) (#3490) 2019-12-20 10:04:02 -06:00
Phil Freeman
b3e0595a9d Test with postgis 3.0.0 (#3519) 2019-12-18 19:32:15 -06:00
nizar-m
c0038a74a5 Allow request body to be logged even with successful queries (#3529) 2019-12-16 15:02:05 -06:00
Rakesh Emmadi
421a182f64 export metadata without nulls, empty arrays & default values (#3393)
* export metadata without nulls, empty arrays
* property tests for 'ReplaceMetadata' using QuickCheck
-> Derive Arbitrary class for 'ReplaceMetadata' dependant types

* reduce property test cases number to 30
QuickCheck generates the `ReplaceMetadata` value really large
for higher number test cases. Encoded JSON for such values is large and
consumes more memory. Thus, CI is giving up while running property
tests.

* circle-ci: Add property tests as saperate job
* add no command mode to tests
* add yaml.v2 to go mod
* remove indirect comment for yaml.v2 dependency
2019-12-14 00:47:38 -06:00
Brandon Simmons
55bc9d57ef Fix documentation of HASURA_GRAPHQL_PG_CONNECTIONS (#3495) 2019-12-12 14:10:04 -06:00
Anon Ray
b81d22f583 fix resolving user info in websocket transport (#3509)
The connection handler in websocket transport was not using the
  'UserAuthentication' interface to resolve user info. Fix resolving
  user info in websocket transport to use the common
  'UserAuthentication' interface
2019-12-10 19:04:49 -06:00
Rakesh Emmadi
60acf7c081 fix json/jsonb columns as String values in nested returning of a mutation (fix #3365) (#3375) 2019-12-10 17:20:55 -06:00
Rakesh Emmadi
9fe6070663 avoid CTE expressions in sql function queries, close #3349 (#3504)
Instead of
'WITH some_alias (SELECT * from some_func()) SELECT <rows> FROM some_alias'
for SQL function queries, Use
'SELECT <rows> FROM some_func() AS some_alias'
2019-12-09 20:27:44 -06:00
Rakesh Emmadi
3f8a1d9ebf fix insert permission views are not unique for long role names (fix #3444) (#3486)
* fix insert permission views are not unique for long role names, fix #3444
* Use GHC notes reference and improve comments
2019-12-09 17:23:06 -06:00
Alexis King
fa0af9728d
Update server/CONTRIBUTING.md and include manual build/test steps (#3472) 2019-12-06 17:58:08 -06:00
Tirumarai Selvan
ff4b2bf8b0 bulk query should not care about access mode of select or count queries (#3467) 2019-12-04 13:16:37 -06:00
Anon Ray
afd6f30e72 read cache control header to refresh JWK (fix #3301) (#3446) 2019-12-03 14:56:59 -06:00
Rakesh Emmadi
cb682e2539 fix updating a column with multiple operators causing postgres query error (fix #3432) (#3458) 2019-12-03 14:00:37 -06:00
Tirumarai Selvan
3cd656f3c7 check db connection in healthz endpoint (close #2645) (#3440)
* check db connection in healthz endpoint
* use Spock.text to automatically set Content-Type
* update docs
2019-12-03 13:18:10 -06:00
nizar-m
9faadec005 remove usage of deprecated 'pytest.config' (#3434)
pytest is now at version 5.3
2019-11-29 10:44:26 +05:30
Anon Ray
c9b9ed5055 fix various functions to not create their own logger (#3439) 2019-11-28 14:33:14 +05:30
Anon Ray
490b639981 refactor some internal components (#3414) 2019-11-26 17:44:21 +05:30
Vamshi Surabhi
6abe8d7927 allow specifying an upper limit on the query plan cache size (#3012) 2019-11-25 11:12:23 -06:00
Rakesh Emmadi
c4c5dd87ac allow identical fields in custom column names configuration (fix #3137) & improve root fields validation (#3154)
* allow identical column fields in 'custom_column_names'
* improve validation of custom column names
* improve 'checkForFieldConflicts' & validate custom column names with non column fields
* split `validateTableConfig` into two isolated validation logic
* improve validation of root fields
* improve validating custom root fields and duplicate root fields
* move 'validateCustomRootFields' to 'buildSchemaCache'
2019-11-20 06:40:56 -06:00
Rakesh Emmadi
9b8e6b42d1 functions can access session info via input arg (close #2322) (#3143) 2019-11-20 12:17:06 +05:30
Alexis King
ec6df7c884
Merge pull request #3356 from jberryman/issue-3312-dev.sh-support-python-3.7 2019-11-15 10:39:46 -06:00
Tirumarai Selvan
d2b2a58c0e add read_only to run_sql metadata api (#3191) 2019-11-14 18:20:18 -06:00
Brandon Simmons
a1da8bcfdd Fix product_mul_price test
The intention was to make this two cases, using a top-level YAML list.
The result was one test with duplicate keys (effectively only running
the second test). This is an error that's now flagged by newer ruamel.

Both tests needed to be "corrected" to pass and need review.
2019-11-14 18:53:33 -05:00
Brandon Simmons
92b1f9c93d In tests: fix extraneous extra keys in yaml 2019-11-14 18:53:33 -05:00
Brandon Simmons
da78a77fb2 In tests/dev.sh: upgrade ruamel to support python 3.7. Closes #3312
Tested on python 3.5 and 3.7

We make light use of pyenv to set an appropriate python version if
installed. We could easily install a correct version too if we wanted
but that seemed invasive.

The newer ruamel was an annoying upgrade but also offers some
improvements that exposed some test suite issues (fixed later).
2019-11-14 18:53:33 -05:00
Tirumarai Selvan
ffeda35ff7 add few x-forwarded- headers (close #2572) (#3347) 2019-11-13 14:25:11 -06:00
Tirumarai Selvan
3cad1319c4 improve event fetch query (#3236) 2019-11-13 12:59:19 +05:30
Rakesh Emmadi
3888ceb24a computed fields in export/import metadata, other fixes (#3211) 2019-11-07 20:09:48 +05:30
Rakesh Emmadi
37dd0966d0 fix insert with nested returning clause fails alongside text[] column (fix #3148 & #2520) (#3198) 2019-11-06 23:14:36 -06:00
Rakesh Emmadi
1b96ebc7d2 deterministic ordering of objects in exported metadata (close #3125) (#3230)
* deterministic ordering of objects in exported metadata, close #3125
* refactor 'Hasura.RQL.DDL.Metadata'
2019-11-05 20:11:03 -06:00
Brandon Simmons
008a3df359 Comment flaky test_jsonb_has_all test 2019-11-05 15:15:25 -06:00
Brandon Simmons
a89777c808 Fix result ordering in some incorrect tests
These were generated with `--accept` and inspected individually.

Mark failing cases as xfail: #3271
2019-11-05 15:15:25 -06:00
Brandon Simmons
91aee7fdeb Test result ordering, add --accept test mode to automatically accept changed test cases
We add a new pytest flag `--accept` that will automatically write back
yaml files with updated responses. This makes it much easier and less
error-prone to update test cases when we expect output to change, or
when authoring new tests.

Second we make sure to test that we actually preserve the order of the
selection set when returning results. This is a "SHOULD" part of the
spec but seems pretty important and something that users will rely on.

To support both of the above we use ruamel.yaml which preserves a
certain amount of formatting and comments (so that --accept can work in
a failry ergonomic way), as well as ordering (so that when we write yaml
the order of keys has meaning that's preserved during parsing).

Use ruamel.yaml everywhere for consistency (since both libraries have
different quirks).

Quirks of ruamel.yaml:
- trailing whitespace in multiline strings in yaml files isn't written
  back out as we'd like: https://bitbucket.org/ruamel/yaml/issues/47/multiline-strings-being-changed-if-they
- formatting is only sort of preserved; ruamel e.g. normalizes
  indentation. Normally the diff is pretty clean though, and you can
  always just check in portions of your test file after --accept

fixup
2019-11-05 15:15:25 -06:00
Brandon Simmons
81fe4a23cf Test fixup: 'yes' being YAML synonym for 'true' is dubious
See: https://stackoverflow.com/q/57682657/176841

I don't think this is something we care about, and we need to fix this
for ruamel which uses the more sane v1.2 spec.
2019-11-05 15:15:25 -06:00
Shahidh K Muhammed
ba751450be change pg_dump version to 12 in server makefile (#3249) 2019-10-26 12:03:54 -05:00
Shahidh K Muhammed
31e0225230
add tests with postgres 12 (close #2749) (#3102) 2019-10-26 11:09:57 +05:30
Rakesh Emmadi
6d92e4f9db save permissions, relationships and collections in catalog with 'is_system_defined' explicitly (#3165)
* save permissions, relationships and collections in catalog with 'is_system_defined'
* Use common stanzas in the .cabal file
* Refactor migration code into lib instead of exe
* Add new server test suite that exercises migrations
* Make graphql-engine clean succeed even if the schema does not exist
2019-10-21 11:01:05 -05:00
nizar-m
842913f566 Add tests for directives skip and include and basic tests for fragments (fix #3180) (#3185)
* Add tests for directives include and skip
* Add basic tests for fragments
2019-10-20 06:59:41 -05:00
Rakesh Emmadi
d8d21c1487 support computed fields returning scalars or set of tables (close #1387) (#2917) 2019-10-18 13:59:47 +05:30
Alexis King
e01008413e
Track variable uses within query validation for caching (fix #3097) (#3135)
This fix is a little ugly, but it’s the only simple solution without a
significant refactoring that restructures the relationship between
GraphQL/Validate and GraphQL/Resolve. The ugliness should go away if we
implement something like #2801.
2019-10-16 09:33:34 -05:00
Ajeet D'Souza
a66fb42ce2 Make catalog metadata migrations work on all schema versions (fix #2826) (#2379)
* Separate DB and metadata migrations
* Refactor Migrate.hs to generate list of migrations at compile-time
* Replace ginger with shakespeare to improve performance
* Improve migration log messages
2019-10-11 00:13:57 -05:00
Alexis King
c0d7402e15
Fix two enum table reference bugs (fix #2820 and #3010) (#3074)
* Include enum types in schema whenever references are visible (fix #2820)
* Fix RQL parsing for nullable enum table references (fix #3010)
2019-10-10 21:22:16 -05:00
Rakesh Emmadi
b0d60ec14f fix hdb_catalog.hdb_column view (fix #3083) (#3084) 2019-10-10 10:11:17 -05:00
Alexis King
3ef6feb394
server: Fix flaky logging test (#3081)
The changes in 0c74839934 adjusted the
format of error logs slightly to omit fields instead of including them
with null values. However, this was rarely triggered by this test
because it only looks at the first log message, but log messages can
sometimes be written out of order. This makes the test order-agnostic.
2019-10-10 08:40:19 -05:00
Rakesh Emmadi
f3b418c631 support where clause in on_conflict of insert mutation (close #2795) (#3002) 2019-10-09 05:09:20 -05:00