Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pdfr-43151] Fix failing tests for draupnir #675

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

erungis
Copy link
Contributor

@erungis erungis commented Oct 30, 2024

Need to upgrade dependencies but ran into test issues

Tests were failing with:

13 examples, 5 failures
Failed examples:
rspec ./spec/draupnir/instance_spec.rb:67 # /instances POST /instances creates the instance if given a ready image
rspec ./spec/draupnir/instance_spec.rb:117 # /instances GET /instances returns a JSON payload showing the instance
rspec ./spec/draupnir/instance_spec.rb:143 # /instances GET /instances/:id shows the given instance
rspec ./spec/draupnir/instance_spec.rb:184 # /instances GET /instances/:id returns the correct credentials for a given instance
rspec ./spec/draupnir/instance_spec.rb:208 # /instances DELETE /instances/:id deletes the instance and returns a 204
make: *** [Makefile:26: test-integration] Error 1

When container is built it is running tests towards it, it fails to create instance with error:

time="2024-10-30T14:03:18Z" level=info msg="Creating instance" client_ip_address=192.168.127.1 environment=test error="exit status 1" 

....

error: connection to server at \"localhost\" (::1), port 17007 failed: FATAL:  no pg_hba.conf entry for host \"::1\", user \"draupnir\", database \"postgres\", no encryption\n+ echo 'INFO: Not able to connect via non-TLS connection'

...
nINFO: Not able to connect without client certificate\nStopping instance\nwaiting for server to shut down.... done\nserver stopped\n"

so therefore we are met with 500 error:

time="2024-10-30T14:03:18Z" level=info msg="POST /instances 500 0.790049" client_ip_address=192.168.127.1 duration=0.790048763 environment=test error="failed to create instance: exit status 1"

I modified current pg_hba.conf:

local   all     all                             trust
hostssl all     draupnir        0.0.0.0/0       cert    map=draupnir

to

local   all             all                                     trust
hostssl all             draupnir        127.0.0.1/32            cert    map=draupnir
hostssl all             draupnir        ::1/128                 cert    map=draupnir
hostssl all             draupnir        0.0.0.0/0               cert    map=draupnir

With these changes:

  • We retain local trust for all users and dbs;
  • Added explicit localhost rule that will allows local connections, also from ipv6 on local podman setup.
  • All hostssl entries continue to use the cert auth with map=draupnir.

and the result = 13 examples, 0 failures

Need to upgrade dependencies but ran into test issues

Tests were failing with:

```
13 examples, 5 failures
Failed examples:
rspec ./spec/draupnir/instance_spec.rb:67 # /instances POST /instances creates the instance if given a ready image
rspec ./spec/draupnir/instance_spec.rb:117 # /instances GET /instances returns a JSON payload showing the instance
rspec ./spec/draupnir/instance_spec.rb:143 # /instances GET /instances/:id shows the given instance
rspec ./spec/draupnir/instance_spec.rb:184 # /instances GET /instances/:id returns the correct credentials for a given instance
rspec ./spec/draupnir/instance_spec.rb:208 # /instances DELETE /instances/:id deletes the instance and returns a 204
make: *** [Makefile:26: test-integration] Error 1
```

When container is built it is running tests towards it, it fails to create instance with error:

```
time="2024-10-30T14:03:18Z" level=info msg="Creating instance" client_ip_address=192.168.127.1 environment=test error="exit status 1"

....

error: connection to server at \"localhost\" (::1), port 17007 failed: FATAL:  no pg_hba.conf entry for host \"::1\", user \"draupnir\", database \"postgres\", no encryption\n+ echo 'INFO: Not able to connect via non-TLS connection'

...
nINFO: Not able to connect without client certificate\nStopping instance\nwaiting for server to shut down.... done\nserver stopped\n"
```

so therefore we are met with 500 error:

`time="2024-10-30T14:03:18Z" level=info msg="POST /instances 500 0.790049" client_ip_address=192.168.127.1 duration=0.790048763 environment=test error="failed to create instance: exit status 1"`

I modified current pg_hba.conf:

```
local   all     all                             trust
hostssl all     draupnir        0.0.0.0/0       cert    map=draupnir
```
to

```
local   all             all                                     trust
hostssl all             draupnir        127.0.0.1/32            cert    map=draupnir
hostssl all             draupnir        ::1/128                 cert    map=draupnir
hostssl all             draupnir        0.0.0.0/0               cert    map=draupnir
```

With these changes:
* We retain local trust for all users and dbs;
* Added explicit localhost rule that will allows local connections, also from ipv6 on local podman setup.
* All hostssl entries continue to use the cert auth with map=draupnir.

and the result = `13 examples, 0 failures`
@erungis erungis changed the title [Pdfr-43151] Fix tests draupnir [Pdfr-43151] Fix failing tests for draupnir Oct 30, 2024
Copy link

@ttamimi ttamimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

@erungis erungis merged commit bfeeb61 into master Oct 30, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants