Skip to content

Commit

Permalink
chore: Moved mock server crates to pact-foundation/pact-core-mock-server
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed May 7, 2024
1 parent fa2b1d0 commit f5ad729
Show file tree
Hide file tree
Showing 54 changed files with 117 additions and 6,253 deletions.
273 changes: 105 additions & 168 deletions rust/Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ members = [
"pact_*"
]
exclude = [
"pact_mock_server",
"pact_mock_server_cli",
"pact_wasm",
"pact_cli"
]
Expand Down
15 changes: 6 additions & 9 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This project provides a Pact implementation written in Rust. It supports the [V3
and [V4 Pact specification](https://github.com/pact-foundation/pact-specification/tree/version-4) and provides shared
libraries that can be used in other languages via foreign function interfaces (FFI).

Note: The mock server crates have moved to https://github.com/pact-foundation/pact-core-mock-server.

## Installing / Getting started

### Rust Projects
Expand Down Expand Up @@ -56,16 +58,13 @@ This is a library that provides the Pact functions for matching requests and res

This is a library that implements exported functions using C bindings for use in foreign languages.

### [pact_mock_server](./pact_mock_server)
### [pact_mock_server](https://github.com/pact-foundation/pact-core-mock-server/pact_mock_server)

This is a library that provides an in-process mock server for Pact client tests. It uses the [pact_matching](./pact_matching)
library.
Moved to https://github.com/pact-foundation/pact-core-mock-server.

### [pact_mock_server_cli](./pact_mock_server_cli)
### [pact_mock_server_cli](https://github.com/pact-foundation/pact-core-mock-server/pact_mock_server_cli)

This module provides a command line executable that provides a standalone pact mock server and commands for controlling
the mock servers. It uses the [libpact_mock_server](./pact_mock_server) and [libpact_matching](./pact_matching)
libraries.
Moved to https://github.com/pact-foundation/pact-core-mock-server.

### [pact_consumer](./pact_consumer)

Expand Down Expand Up @@ -111,8 +110,6 @@ Rust crate documentation is published to the Rust documentation site.
* [pact_consumer](https://docs.rs/pact_consumer/)
* [pact_matching](https://docs.rs/pact_matching/)
* [pact_ffi](https://docs.rs/pact_ffi/)
* [pact_mock_server](https://docs.rs/pact_mock_server/)
* [pact_mock_server_cli](https://docs.rs/pact_mock_server_cli/)
* [pact_models](https://docs.rs/pact_models/)
* [pact_verifier](https://docs.rs/pact_verifier/)
* [pact_verifier_cli](https://docs.rs/pact_verifier_cli/)
Expand Down
2 changes: 1 addition & 1 deletion rust/pact_consumer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ itertools = "0.12.1"
lazy_static = "1.4.0"
maplit = "1.0.2"
pact_matching = { version = "~1.2.2", path = "../pact_matching", default-features = false }
pact_mock_server = { version = "~1.2.6", path = "../pact_mock_server", default-features = false }
pact_mock_server = { version = "~1.2.6", default-features = false }
pact_models = { version = "~1.2.0", default-features = false }
pact-plugin-driver = { version = "~0.6.1", optional = true, default-features = false }
regex = "1.10.4"
Expand Down
2 changes: 1 addition & 1 deletion rust/pact_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ maplit = "1.0.2"
multipart = { version = "0.18.0", default-features = false, features = ["client", "mock"] }
onig = { version = "6.4.0", default-features = false }
pact_matching = { version = "~1.2.2", path = "../pact_matching" }
pact_mock_server = { version = "~1.2.6", path = "../pact_mock_server" }
pact_mock_server = { version = "~1.2.6" }
pact_models = { version = "~1.2.0" }
pact-plugin-driver = { version = "~0.6.1" }
pact_verifier = { version = "~1.2.0", path = "../pact_verifier" }
Expand Down
715 changes: 0 additions & 715 deletions rust/pact_mock_server/CHANGELOG.md

This file was deleted.

55 changes: 0 additions & 55 deletions rust/pact_mock_server/Cargo.toml

This file was deleted.

47 changes: 1 addition & 46 deletions rust/pact_mock_server/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,3 @@
# Pact Mock Server library

This library implements the in-process mock server for matching HTTP requests and generating responses from a pact file.
It implements the [V3 Pact specification](https://github.com/pact-foundation/pact-specification/tree/version-3)
and [V4 Pact specification](https://github.com/pact-foundation/pact-specification/tree/version-4).

[Online rust docs](https://docs.rs/pact_mock_server/latest/pact_mock_server/)

All the exported functions using C bindings for controlling the mock server are now found in the [pact_ffi module](https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_ffi).

## [create_mock_server](https://docs.rs/pact_mock_server/latest/pact_mock_server/fn.create_mock_server.html)

Creates a mock server. Requires the pact JSON as a string as well as the port for the mock server to run on. A value of
0 for the port will result in a port being allocated by the operating system. The port of the mock server is returned.

## [mock_server_matched](https://docs.rs/pact_mock_server/latest/pact_mock_server/fn.mock_server_matched.html)

Simple function that returns a boolean value given the port number of the mock service. This value will be true if all
the expectations of the pact that the mock server was created with have been met. It will return false if any request did
not match, an un-recognised request was received or an expected request was not received.

## [mock_server_mismatches](https://docs.rs/pact_mock_server/latest/pact_mock_server/fn.mock_server_mismatches.html)

This returns all the mismatches, un-expected requests and missing requests in JSON format, given the port number of the
mock server.

## [shutdown_mock_server](https://docs.rs/pact_mock_server/latest/pact_mock_server/fn.shutdown_mock_server.html)

Shuts down the mock server with the provided port. Returns a boolean value to indicate if the mock server was successfully shut down.

## [write_pact_file](https://docs.rs/pact_mock_server/latest/pact_mock_server/fn.write_pact_file.html)

Trigger a mock server to write out its pact file. This function should be called if all the consumer tests have passed.
The directory to write the file to is passed as the second parameter. If None is passed in, the current working
directory is used. If overwrite is true, the file will be overwritten with the contents of the current pact. Otherwise
it will be merged with any existing pact file.

Returns Ok if the pact file was successfully written. Returns an Err if the file can not be written, or there is no
mock server running on that port.

## Crate features
All features are enabled by default

* `datetime`: Enables support of date and time expressions and generators.
* `xml`: Enables support for parsing XML documents.
* `plugins`: Enables support for using plugins.
* `multipart`: Enables support for MIME multipart bodies.
* `tls`: Enables support for mock servers using TLS. This will add the following dependencies: hyper-rustls, rustls, rustls-pemfile, tokio-rustls.
Moved to https://github.com/pact-foundation/pact-core-mock-server/pact_mock_server
113 changes: 0 additions & 113 deletions rust/pact_mock_server/release.groovy

This file was deleted.

Loading

0 comments on commit f5ad729

Please sign in to comment.