Postgres insufficient privilege

My tests pass locally, but on Circle they fail with this error:

ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: could not open file.

My tests write files to the “/tmp” directory.

circle.yml

database:
  override:
    - bin/setup
test:
  override:
    - COVERAGE=true bin/rake

Can you share the part of your code that causes this error?

I can only post one link apparently, but here are the tests:
https://github.com/SturdyCo/aact2/blob/csv/spec/models/ table_exporter_spec.rb

The code it’s running is in the TableExporter model in the same repo.

Now the build is failing with: No such file or directory @ dir_initialize - /home/ubuntu/aact2/tmp

I assume this is because I am trying to write files to the tmp directory, which is not in source control. I have code in the TableExporter model that will try to create a tmp directory if none exists, but that doesn’t seem to be working.

Solved! Added a post checkout hook to my circle.yml to create the tmp directory.

1 Like