SeUniVr / RestTestGen

A framework for automated black-box testing of RESTful APIs.
Apache License 2.0
38 stars 9 forks source link

Error during execution #19

Closed daniellenix closed 6 months ago

daniellenix commented 6 months ago

Hi Davide,

I'm trying to follow the docker build instructions but when I run docker run --rm -v ./:/app --network host rtg I get the following error.

I'm running this on Ubuntu.

How can I fix this?

Thanks,

image

davidecorradini commented 6 months ago

Hi Danielle!

It seems to be a configuration error. I suppose you configured RTG for a new API, and created the proper API directory under `apis/'. Is this is the case, please make sure that the directory is named only with supporter characters that are letters, numbers, -, and _.

Please let me know if this change fixes the problem. Conversely, please paste here your configuration file and I will check it out.

Best, Davide

daniellenix commented 6 months ago

Hi Davide,

Thanks for the quick reply. I believe I fixed the issue by removing a space and keeping the names consistent. Although now I believe I am having other issues with connectivity and timeout even though I can access my api through localhost port 38080. I seem to be able to generate the results folder.

The terminal also occasionally prints this error:

00:17:50.018 [main] WARN io.resttestgen.core.datatype.parameter.structured.ArrayParameter - Format for deep nested arrays is not defined in the reference RFC. Use this method only for RFC defined behaviors.

Screenshot_from_2024-04-04_17-18-41 Screenshot_from_2024-04-04_17-18-50 Screenshot_from_2024-04-04_17-19-03

Let me know if you would like more information.

Thanks, Danielle

davidecorradini commented 6 months ago

Hello Danielle,

About this warning: 00:17:50.018 [main] WARN io.resttestgen.core.datatype.parameter.structured.ArrayParameter - Format for deep nested arrays is not defined in the reference RFC. Use this method only for RFC defined behaviors. This happens when the specification defines nested arrays in non-body parameters without specifying the format. As multiple ways to encode nested arrays are possible, and there is no standard for it, RTG needs to know which format to use. This warning is non-blocking, and the only downside is that RTG might not be able to generate valid input data for the array. I believe you can ignore this.

Concerning the connectivity problem, this happens when RTG is running within a container and cannot reach the API that is running on the host machine or in another container. Have you used the --network host flag in the docker run command to make sure that the container of RTG is on the same network interface as the host? If the problem still occurs with the flag, you could update the specification by replacing localhost with the IP address of the host machine on the docker0 network interface, which is typically 172.17.0.1, but might be different (you can check your network interfaces with ifconfig). If this still does not work, it is possible that Docker is broken in some way (it happened before on my machine) and does not let containers reach the internet or the local network. This can happen if multiple instances of docker are installed on your machine (for instance the cli and the desktop version). In that case, you should reset the Docker context and other make other fixes I currently don't remember. Or you should just try to run RTG locally, outside Docker.

Let me know if you are able to run RTG!

Best, Davide

daniellenix commented 6 months ago

Hi Davide,

Replacing localhost with 10.0.1.155 worked for me!

Thanks, Danielle