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

feat: remove /hello from tests/ci #863

Merged
merged 5 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/qa-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cargo shuttle run &
sleep 70

echo "Testing local wasm endpoint"
output=$(curl --silent localhost:8000/hello)
output=$(curl --silent localhost:8000)
[ "$output" != "Hello, World!" ] && ( echo "Did not expect output: $output"; exit 1 )

killall cargo-shuttle
4 changes: 2 additions & 2 deletions .circleci/qa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cargo shuttle run &
sleep 150

echo "Testing local hello endpoint"
output=$(curl --silent localhost:8000/hello)
output=$(curl --silent localhost:8000)
[ "$output" != "Hello, world!" ] && ( echo "Did not expect output: $output"; exit 1 )

killall cargo-shuttle
Expand All @@ -24,7 +24,7 @@ cargo shuttle project start
cargo shuttle deploy --allow-dirty

echo "Testing remote hello endpoint"
output=$(curl --silent https://qa-$1.unstable.shuttleapp.rs/hello)
output=$(curl --silent https://qa-$1.unstable.shuttleapp.rs)
[ "$output" != "Hello, world!" ] && ( echo "Did not expect output: $output"; exit 1 )

cargo shuttle project stop
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Test if the deployment is working:

```bash
# the Host header should match the Host from the deploy output
curl --header "Host: {app}.unstable.shuttleapp.rs" localhost:8000/hello
curl --header "Host: {app}.unstable.shuttleapp.rs" localhost:8000
```

View logs from the current deployment:
Expand Down
6 changes: 3 additions & 3 deletions cargo-shuttle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ fn index() -> &'static str {

#[shuttle_runtime::main]
async fn rocket() -> shuttle_rocket::ShuttleRocket {
let rocket = rocket::build().mount("/hello", routes![index]);
let rocket = rocket::build().mount("/", routes![index]);

Ok(rocket.into())
}
Expand All @@ -142,7 +142,7 @@ cargo shuttle run
This will compile your shuttle project and start it on the default port `8000`. Test it by:

```sh
$ curl http://localhost:8000/hello
$ curl http://localhost:8000
Hello, world!
```

Expand Down Expand Up @@ -173,7 +173,7 @@ cargo shuttle deploy
Your service will immediately be available at `{crate_name}.shuttleapp.rs`. For instance:

```sh
$ curl https://my-rocket-app.shuttleapp.rs/hello
$ curl https://my-rocket-app.shuttleapp.rs
Hello, world!
```

Expand Down
12 changes: 6 additions & 6 deletions cargo-shuttle/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl ShuttleInit for ShuttleInitActixWeb {
use actix_web::{get, web::ServiceConfig};
use shuttle_actix_web::ShuttleActixWeb;

#[get("/hello")]
#[get("/")]
async fn hello_world() -> &'static str {
"Hello World!"
}
Expand Down Expand Up @@ -166,7 +166,7 @@ impl ShuttleInit for ShuttleInitAxum {

#[shuttle_runtime::main]
async fn axum() -> shuttle_axum::ShuttleAxum {
let router = Router::new().route("/hello", get(hello_world));
let router = Router::new().route("/", get(hello_world));

Ok(router.into())
}"#}
Expand Down Expand Up @@ -223,7 +223,7 @@ impl ShuttleInit for ShuttleInitRocket {

#[shuttle_runtime::main]
async fn rocket() -> shuttle_rocket::ShuttleRocket {
let rocket = rocket::build().mount("/hello", routes![index]);
let rocket = rocket::build().mount("/", routes![index]);

Ok(rocket.into())
}"#}
Expand Down Expand Up @@ -275,7 +275,7 @@ impl ShuttleInit for ShuttleInitTide {
let mut app = tide::new();
app.with(tide::log::LogMiddleware::new());

app.at("/hello").get(|_| async { Ok("Hello, world!") });
app.at("/").get(|_| async { Ok("Hello, world!") });

Ok(app.into())
}"#}
Expand Down Expand Up @@ -332,7 +332,7 @@ impl ShuttleInit for ShuttleInitPoem {

#[shuttle_runtime::main]
async fn poem() -> ShuttlePoem<impl poem::Endpoint> {
let app = Route::new().at("/hello", get(hello_world));
let app = Route::new().at("/", get(hello_world));

Ok(app.into())
}"#}
Expand Down Expand Up @@ -839,7 +839,7 @@ impl ShuttleInit for ShuttleInitThruster {
#[shuttle_runtime::main]
async fn thruster() -> shuttle_thruster::ShuttleThruster<HyperServer<Ctx, ()>> {
let server = HyperServer::new(
App::<HyperRequest, Ctx, ()>::create(generate_context, ()).get("/hello", m![hello]),
App::<HyperRequest, Ctx, ()>::create(generate_context, ()).get("/", m![hello]),
);

Ok(server.into())
Expand Down
2 changes: 1 addition & 1 deletion cargo-shuttle/tests/integration/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ fn assert_valid_rocket_project(path: &Path, name_prefix: &str) {

#[shuttle_runtime::main]
async fn rocket() -> shuttle_rocket::ShuttleRocket {
let rocket = rocket::build().mount("/hello", routes![index]);
let rocket = rocket::build().mount("/", routes![index]);

Ok(rocket.into())
}"#};
Expand Down
29 changes: 11 additions & 18 deletions cargo-shuttle/tests/integration/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async fn rocket_hello_world() {
let url = cargo_shuttle_run("../examples/rocket/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand Down Expand Up @@ -149,14 +149,7 @@ async fn shuttle_next() {
let url = cargo_shuttle_run("../examples/next/hello-world", false).await;
let client = reqwest::Client::new();

let request_text = client
.get(format!("{url}/hello"))
.send()
.await
.unwrap()
.text()
.await
.unwrap();
let request_text = client.get(&url).send().await.unwrap().text().await.unwrap();

assert_eq!(request_text, "Hello, World!");

Expand Down Expand Up @@ -236,7 +229,7 @@ async fn actix_web_hello_world() {
let url = cargo_shuttle_run("../examples/actix-web/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand All @@ -253,7 +246,7 @@ async fn axum_hello_world() {
let url = cargo_shuttle_run("../examples/axum/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand All @@ -270,7 +263,7 @@ async fn tide_hello_world() {
let url = cargo_shuttle_run("../examples/tide/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand All @@ -287,7 +280,7 @@ async fn tower_hello_world() {
let url = cargo_shuttle_run("../examples/tower/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand All @@ -304,7 +297,7 @@ async fn warp_hello_world() {
let url = cargo_shuttle_run("../examples/warp/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand All @@ -321,7 +314,7 @@ async fn poem_hello_world() {
let url = cargo_shuttle_run("../examples/poem/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand Down Expand Up @@ -402,7 +395,7 @@ async fn salvo_hello_world() {
let url = cargo_shuttle_run("../examples/salvo/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand All @@ -419,7 +412,7 @@ async fn thruster_hello_world() {
let url = cargo_shuttle_run("../examples/thruster/hello-world", false).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand All @@ -435,7 +428,7 @@ async fn rocket_hello_world_with_router_ip() {
let url = cargo_shuttle_run("../examples/rocket/hello-world", true).await;

let request_text = reqwest::Client::new()
.get(format!("{url}/hello"))
.get(url)
.send()
.await
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion examples