21569

Google App Engine Require Indexes for tests

Question:

I just got bit by my functional tests not using the same settings as my dev_appserver. I currently run my dev_appserver (non-rel) with require_indexes.

How to I force my test bed to use the same setings?

I have tried using SetupIndexes but it did not "require" they be defined in my index.yaml. I did not have the setting correct and as a result i can do any query I want.

i.e.

clz.testbed = Testbed() clz.testbed.activate() clz.testbed.init_memcache_stub() clz.testbed.init_taskqueue_stub() clz.testbed.init_urlfetch_stub() clz.testbed.init_datastore_v3_stub(use_sqlite=True, datastore_file=somepath) SetupIndexes('','') model.objects().filter(x=1, y=2.....) #will work regardless of index defined.

but when the query executes on the server i get the

<blockquote>

NeedIndexError: This query requires a composite index that is not defined. You must update the index.yaml file in your application root. The following index is the minimum index required:

</blockquote>

Answer1:

Try adding { "require_indexes" : True } as a keyword argument to init_datastore_v3_stub()

You can look through (and step through) the SDK code to see how that parameter is eventually passed into the datastore stub.

Recommend

  • An Angular2 app with karma & jasmine throws errors with multi-level directory structure
  • Load plugin DLL into WebAPI application
  • Google App Engine Require Indexes for tests
  • Better pattern to handle DAO creation for POJO using SQLite
  • Angular2 unit testing : testing a component's constructor
  • How to query the shadowDOM in an Angular component test
  • Test module can't resolve module being tested [Angular4, Karma, Jasmine]
  • why is cobra not reading my config file
  • Why is YAML.load returning the wrong numeric value?
  • How do I specify custom wording in a will_paginate view helper?
  • Use OAuth2 for authentication + compatibility with google.appengine.api.users service
  • How to query property value when property name is a parameter?
  • Web.config system.webserver errors
  • WPF - CanExecute dosn't fire when raising Commands from a UserControl
  • Can you perform a UNION without a subquery in SQLAlchemy?
  • PostgreSQL Query without WHERE only ORDER BY and LIMIT doesn't use index
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Display Images one by one with next and previous functionality
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • Rearranging Cells in UITableView Bug & Saving Changes
  • 0x202A in filename: Why?
  • php design question - will a Helper help here?
  • SQL merge duplicate rows and join values that are different
  • AngularJs get employee from factory
  • Proper way to use connect-multiparty with express.js?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • File not found error Google Drive API
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Linking SubReports Without LinkChild/LinkMaster
  • Authorize attributes not working in MVC 4
  • Conditional In-Line CSS for IE and Others?