Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deem0n committed May 22, 2023
1 parent ad8d0cb commit 2cf41fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
nim-nats is a [Nim](https://nim-lang.org/) wrapper for the [nats-c](https://github.com/nats-io/nats.c) library.
nim-nats is a [Nim](https://nim-lang.org/) wrapper for the [nats.c](https://github.com/nats-io/nats.c) library.

nim-nats is distributed as a [Nimble](https://github.com/nim-lang/nimble) package. nats.nim wrapper is generated with [nimgen](https://github.com/genotrance/nimgen) and [c2nim](https://github.com/nim-lang/c2nim/).

nim-nats may be linked with dynamic nats-c lib which must be installed on the system and be available at runtime. You can link statically as well (see tests folder). On Mac OS X you can easily install lib with `brew install cnats`
nim-nats may be linked with dynamic nats.c lib which must be installed on the system and be available at runtime. You can link statically as well (see tests folder). On Mac OS X you can easily install lib with `brew install cnats`

Latest nim-nats version 3.x should work with NATS 3.x

Expand Down Expand Up @@ -41,7 +41,7 @@ could not load: libnats.so

It happens if your system protobuf_c lib is outdated. For example, CentOS 7 has protobuf_c 1.0.x while current version is 1.3.x.
It seems that recent cnats wants recent protobuf, which is not available on recent Linux distros, ops.
To avoid dll hell I recomend to statically link against `libnats_static.a` (which is installed by default by `nats-c`).
To avoid dll hell I recomend to statically link against `libnats_static.a` (which is installed by default by `nats.c`).
But to make that possible you will need to compile static version of `protobuf_c.a` or pick it up from [cnats distribution](https://github.com/nats-io/cnats/tree/master/pbuf/lib).

```
Expand Down Expand Up @@ -74,7 +74,6 @@ __Testing__
```
git clone https://github.com/deem0n/nim-nats
cd nim-nats
nimble setup
nimble test
```

Expand All @@ -83,7 +82,7 @@ __Testing__

__Development__

You will need latest `nimgen`, which is not released. Also I probably will migrate to the nimterop one day. For now you can try to run `nimble setup`, which will download some `nats-c` headers from github and will run `nimgen` to convert headers to nim.
You will need latest `nimgen`, which is not released. Also I probably will migrate to the nimterop one day. For now you can try to run `nimble setup`, which will download some `nats.c` headers from github and will run `nimgen` to convert headers to nim.

```
nimble install nimgen@#HEAD
Expand All @@ -95,15 +94,16 @@ You will need latest `nimgen`, which is not released. Also I probably will migra

__Credits__

nim-nats wraps the cnats source code and all licensing terms of [cnats](https://github.com/nats-io/cnats/blob/master/LICENSE) apply to the usage of this package. cnats is licensed under Apache 2.0. All other code (i.e tests) in this repo is licensed under MIT license.
nim-nats wraps the cnats source code and all licensing terms of [nats.c](https://github.com/nats-io/nats.c/blob/main/LICENSE) apply to the usage of this package. cnats is licensed under Apache 2.0. All other code (i.e tests) in this repo is licensed under MIT license.

Credits go out to [c2nim](https://github.com/nim-lang/c2nim/) and to [nimgen](https://github.com/genotrance/nimgen) as well without which this package would be greatly limited in its abilities.

__Future plans__

1. Add Streaming NATS API
2. More tests
3. Examples of async API with callbacks (requires event loop on the nim side)
1. Add JetStream NATS API
2. Add KV
3. More tests
4. Examples of async API with callbacks (requires event loop on the nim side)

__Feedback__

Expand Down
2 changes: 1 addition & 1 deletion nats.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ task setup, "Download and generate":
task test, "Test nats":
# exec "nim c --passL:'-L/usr/local/lib -lnats_static' -d:nimDebugDlOpen tests/natstest.nim"
exec "nim c -d:nimDebugDlOpen tests/natstest.nim"
withDir("nats"):
withDir("tests"):
exec "kill `cat /tmp/nim-nats-test.pid` > /dev/null 2>&1; echo Old nats-server cleanup done." # sometimes things go wrong, try to clean up
exec "nats-server --port 12345 --debug --trace --pid /tmp/nim-nats-test.pid &"
exec "sleep 1"
Expand Down

0 comments on commit 2cf41fe

Please sign in to comment.