Skip to content

A-Fayez/kcmockserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KcMockServer

An in-memory rust implementation of Kafka Connect compatible REST API designed for testing.

Usage

In your Cargo.toml file, add

[dev-dependencies]
kcmockserver = { git = "https://github.com/A-Fayez/kcmockserver.git" }

In your rust code:

#[test]
fn test() {
    // new() spawns a new in-memory server instance in a new background thread 
    // so that your calling code could be async or not 
    let server = KcTestServer::new();
    let endpoint = format!("{}{}", server.base_url().to_string(), "connectors");

    // here we're using reqwest crate to make the api call but any async or blocking http client can be used
    let reqwest_uri = reqwest::Url::from_str(&endpoint).unwrap();
    let response = reqwest::blocking::get(reqwest_uri).unwrap().text().unwrap();
    assert_eq!(response, "[]");
}

Endpoints Implementation Status

Endpoint Method Status
/connectors GET
/connectors POST
/connectors/:name GET

About

An in-memory rust implementation of Kafka Connect compatible REST API designed for testing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages