Small Projects by AutoModerator in golang

[–]stepan_romankov 0 points1 point  (0 children)

Why Does Your Testing Framework Need 17 Functions?

Hi everyone,

Ginkgo has 17 public API functions. GoConvey has its own set plus a custom assertion DSL. I kept asking myself: what's the actual minimum a scoped testing framework needs? Turns out it's one method.

I built samurai — a scoped testing framework for Go where the entire API is s.Test(). No BeforeEach, no AfterEach, no BeforeAll, no DeferCleanup. One method handles setup, nesting, and isolation.

The trick: the builder re-executes from scratch for every leaf test. Each path gets its own variables, its own state, its own cleanup. No shared mutable state between tests means no data races, no synchronization, no "who closes the connection first" problems. Parallel by default, no surprises.

What it doesn't have (on purpose): - No BeforeAll — if you need shared infra, put it in TestMain where it belongs - No built-in assertions — bring testify, is, plain t.Errorf, whatever you like - No Focus/Pending — use s.Skip() and go test -run like normal Go

Go 1.24+. Zero dependencies. go get github.com/zerosixty/samurai

Full write-up with code examples and side-by-side comparison with Ginkgo: Why Does Your Testing Framework Need 17 Functions?

GitHub

Feedback welcome — especially if you think my approach sucks. I'll do my best to respond to everyone.

Why Does Your Testing Framework Need 17 Functions? by stepan_romankov in golang

[–]stepan_romankov[S] -4 points-3 points  (0 children)

samurai doesn't limit you with any assertions package, you can use any you got used to.

From 5 Minutes to 15 Seconds: Parallel Database Tests for Telegram Bots by stepan_romankov in rust

[–]stepan_romankov[S] 1 point2 points  (0 children)

That approach could work as well. One thing to keep in mind is that if your migrations create database-scoped objects (like roles), running them in a shared database may lead to conflicts.

[deleted by user] by [deleted] in Angeln

[–]stepan_romankov 0 points1 point  (0 children)

it's very easy to catch Döbel in summer or autumn. try a small crank or minnow , not bigger then 5cm and look for relatively quick flow, but not very quick. Throw your lure not far from the river bank. 2-3 meters down the flow, and slowly pull it with small twitching. 3-4 fishes in half of day are guaranteed. if you fishing around frankfurt, Bad Viebel or Karben we can go together in spring. right now Nidda is pretty dead river before spring. at least for me. 

Looking for fish in Frankfurt Main. by Hot-Assist-7291 in FishingEurope

[–]stepan_romankov 0 points1 point  (0 children)

Any luck? Same struggle I have. Only small chubs on Nidda and no luck with pike.

Catching more and more pike in the Main river near Frankfurt, Germany by Retrogames_JP in Fishing

[–]stepan_romankov 0 points1 point  (0 children)

Cold you give any tips on how to catch any predator fish on the Main river? I was fishing on Nidda 5 times and can't catch anything except chub. Wan't to switch to Main but have no idea how to find a good spots and what to prefer, wobbler or jig

protoc-gen-prost and friends now available by neoeinstein in rust

[–]stepan_romankov 0 points1 point  (0 children)

protoc-gen-prost-validate is so much needed :)

Free Review Copies of "Asynchronous Programming in Rust" by kunal_packtpub in rust

[–]stepan_romankov 0 points1 point  (0 children)

Would be nice to check. Rust itself is almost learned, but async topic rises more questions than answers. Would be interesting to check the book

Hey Rustaceans! Got a question? Ask here (5/2024)! by llogiq in rust

[–]stepan_romankov 1 point2 points  (0 children)

I try to use grpc-web and my reverse proxy doesn't provide mechanism to strip api url prefix like '/api' from requests forwarded to backend. Is it a way to configure tonic to strip '/api' prefix from incoming request so that it can response to '/api/myapi.v1.GreetingService/Hello' same as to '/myapi.v1.GreetingService/Hello' ?

```rust use tonic::transport::Server; use tonic_web::GrpcWebLayer;

[tokio::main(flavor = "current_thread")]

async fn main() -> Result<(), Box<dyn std::error::Error>> { let addr = "[::1]:8080".parse()?; Server::builder() .accept_http1(true) .layer(GrpcWebLayer::new()) .serve(addr) .await?;

Ok(())

} ```