HTTPError: 404 Client Error: NOT FOUND for url: http://postgres-backup-daemon:9000/backups

Check Backup List
${PG_ROOT_PASSWORD}= Get Environment Variable PG_ROOT_PASSWORD
${auth}= Create List postgres ${PG_ROOT_PASSWORD}
# wait while daemon will start backup
${backups_in_namespace}= Create Dictionary
FOR ${INDEX} IN RANGE 1 60
Create Session postgres_backup_daemon http://postgres-backup-daemon:9000 auth=${auth}
${resp}= Get On Session postgres_backup_daemon url=/backups
Run Keyword If ${resp.status_code} != ${200} Log ${resp.text}
Run Keyword If ${resp.status_code} == ${200} Set Backups ${resp} ${name_space}
Log ${backups_in_namespace}
${b_count}= Get Length ${backups_in_namespace}
Log ${b_count}
Run Keyword If ${b_count} != ${1} Log ${resp.text}
Run Keyword If ${b_count} == ${1} Exit For Loop
Sleep 1s
END
Should Be Equal ${resp.status_code} ${200}
Length Should Be ${backups_in_namespace} 1
Delete Granular Backup

I am using above code from robot framework to perform some tests.
But for part “Get On Session” I am getting error -HTTPError: 404 Client Error: NOT FOUND for url: http://postgres-backup-daemon:9000/backups

I checked url through deployed pods and it was reachable from them. But here in robot such approach fails. Please suggest how can I fix this issue?

Are you sure the Create Session postgres_backup_daemon http://postgres-backup-daemon:9000 auth=${auth} worked?

What if you remove the http:// from the server URL?

Hi Anshaj,

At first I wasn’t sure what your question was, after a second read i’m still not sure but I think I have an idea?

When the script does this line:

${resp}= Get On Session postgres_backup_daemon url=/backups

you get the error you mention, are you expecting it to continue on to the next few line and the Run Keyword If?:

Log ${backups_in_namespace}
${b_count}= Get Length ${backups_in_namespace}
Log ${b_count}
Run Keyword If ${b_count} != ${1} Log ${resp.text}
Run Keyword If ${b_count} == ${1} Exit For Loop

As you have your test configured it won’t do that because of the implicit assert in GET On Session

From the documentation

By default this keyword fails if a status code with error values is returned in the response, this behavior can be modified using the expected_status and msg parameters, read more about it in Status Should Be keyword documentation. In order to disable this implicit assert mechanism you can pass as expected_status the values any or anything .

So if you want to continue on to the Run Keyword If line, you’ll need to make a change something like this:

${resp}=    Get On Session    postgres_backup_daemon    url=/backups    expected_status=any

The expected_status=any should disable this implicit assert mechanism.

Hope that was what you were after,

Dave.

Hi Dave,
Thank you for your reply.
Actually my issue was that above url - http://postgres-backup-daemon:9000
which I am trying to reach using robot framework is not reachable through my code and throws HTTPError: 404 .
Whereas the same url exists and is reachable when I try to ping it through pods deployed in same namesapce. It’s not like this HTTPError is expected, its more like why I get this error even when the link is valid and reachable.

Hi Anshaj,

This sounds like a problem with your environment not RequestsLibrary, some suggestions to think about:

  • Is the site being blocked by a firewall thats preventing your robot framework machine from accessing the url? can an exception for your machine be made?
  • Can you run the robot framework script on a pod?

Dave.

Hi Hélio Guilherme,
Thanks for your reply. I tried with the approach you suggested, but it resulted in the same error. The url was still not reachable.