Giter Club home page Giter Club logo

Comments (6)

johanneskastl avatar johanneskastl commented on August 28, 2024 1

Thanks @jcamiel I got it working using the python files provided in the integration/hurl/ directory. I only needed to install Flask in addition to python3, which is packaged in openSUSE and is easy to install during package build.

Thanks for your help!

from hurl.

jcamiel avatar jcamiel commented on August 28, 2024

Hi @johanneskastl

When running cargo test, the "integration" tests and docs tests are executed and they need a running local HTTP server. I don't know if it's possible for you but the simplest way to test without any HTTP server is to run cargo test --lib instead of cargo test. This command will execute only tests units that don't need an HTTP server.

Tell me if it's okay this way,

from hurl.

johanneskastl avatar johanneskastl commented on August 28, 2024

Hey @jcamiel thanks for the fast reply. Using --lib seems to work!

Regarding the HTTP server, I was hoping it would be spun up by magic during the testing. That does not seem to be the case.

Any special requirements for that server? Would a simple python3 -m http.server or similar suffice? Or does it need to be a "real" one like Apache/nginx/caddy?

from hurl.

jcamiel avatar jcamiel commented on August 28, 2024

No, for the test we only need a simple server that responds on http://localhost:8000/hello.
python3 -m http.server should be sufficient!

You can find some docs on the test suite here https://github.com/Orange-OpenSource/hurl/blob/master/integration/README.md if you want,

from hurl.

johanneskastl avatar johanneskastl commented on August 28, 2024

I almost got the tests working with a python http.server. Almost, just one error:

[  164s]      Running tests/sample.rs (target/debug/deps/sample-587c3e4b0b396a78)
[  164s] 
[  164s] running 1 test
[  164s] 127.0.0.1 - - [15/Jul/2024 04:42:18] "GET /hello HTTP/1.1" 301 -
[  164s] test simple_sample ... FAILED
[  164s] 
[  164s] failures:
[  164s] 
[  164s] ---- simple_sample stdout ----
[  164s] error: Assert status code
[  164s]   --> -:3:10
[  164s]    |
[  164s]    |     GET http://localhost:8000/hello
[  164s]  3 |     HTTP 200
[  164s]    |          ^^^ actual value is <301>

Apparently the server responds with a 301 if there is no trailing slash. Which works in all other tests, but not in this one.

I just saw the link to the README you gave, I'll have a look later (maybe this is solved in there).

from hurl.

jcamiel avatar jcamiel commented on August 28, 2024

Can you create, if possible, an empty file inside the directory where you're launching the HTTP server?

$ cd /tmp
$ touch hello
$ python3 -m http.server

And then it should be OK:

$ echo 'GET http://locallost:8000/hello' | hurl -i 
HTTP/1.0 200
Server: SimpleHTTP/0.6 Python/3.12.4
Date: Mon, 15 Jul 2024 07:09:07 GMT
Content-type: application/octet-stream
Content-Length: 0
Last-Modified: Mon, 15 Jul 2024 06:40:47 GMT

from hurl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.