Development environment fails to run tests without msfdb --msf-test-db-user-name option

Open
#16,183 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
postgresql, ruby
Domain
database

Research direction

Start with the development-environment setup guide and the ./msfdb init entry point, then reproduce the failure with rake spec. Trace how the msftest database is created and which user owns it. Done means a fresh setup can run rake spec without the manual --msf-test-db-user-name workaround.

Written by the indexing model from the issue text.

Description

bug confirmed

Steps to reproduce

Follow the setup steps, including starting the database with ./msfdb init. No errors are reported until running rake spec.

Were you following a specific guide/tutorial or reading documentation?

https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment

Expected behavior

The test suite should run.

Current behavior

rake spec fails with the error ActiveRecord::StatementInvalid: PG::InsufficientPrivilege: ERROR: must be owner of database msftest.

Fix

I was able to fix the problem by running ./msfdb delete to remove the problematic database and using ./msfdb init --msf-test-db-user-name $(whoami). After this, rake spec runs the tests as expected.

Metasploit version

953a4cb5dc0e6fa2dc0ba0fccf073f96403f4ce2 (HEAD -> master, origin/master, origin/HEAD) Land #16171, Generate links to new docs site

Dominant language
Ruby
Stars
39k
Forks
15k
Avg merge
5d 6h
Merged PRs (30d)
32

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rapid7/metasploit-framework

All issues in rapid7/metasploit-framework

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.