+ # Sanity check: If someone has actually logged in here, this might
+ # not really be a throwaway database. Client test suites should
+ # use @example.com email addresses when creating user records, so
+ # we can tell they're not valuable.
+ user_uuids = User.
+ where('email is null or (email not like ? and email not like ?)', '%@example.com', '%.example.com').
+ collect(&:uuid)
+ fixture_uuids =
+ YAML::load_file(File.expand_path('../../../test/fixtures/users.yml',
+ __FILE__)).
+ values.collect { |u| u['uuid'] }
+ unexpected_uuids = user_uuids - fixture_uuids
+ if unexpected_uuids.any?
+ logger.error("Running in test environment, but non-fixture users exist: " +
+ "#{unexpected_uuids}" + "\nMaybe test users without @example.com email addresses were created?")
+ raise ArvadosModel::PermissionDeniedError
+ end
+