-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker nats-server to testing environment
- Loading branch information
Showing
7 changed files
with
110 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#source: https://github.com/nats-io/nats-docker/blob/060868360489ec6400f3238d633b986103445dd5/2.2.0/scratch/Dockerfile | ||
|
||
FROM scratch | ||
COPY --from=nats:2.2.0-alpine3.13 /usr/local/bin/nats-server /nats-server | ||
COPY nats-serverA.conf /nats-serverA.conf | ||
EXPOSE 4222 8222 6222 | ||
ENTRYPOINT ["/nats-server"] | ||
CMD ["--config", "nats-serverA.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Xunit; | ||
using System.Diagnostics; | ||
using System.Threading; | ||
using System; | ||
using NATS.Client; | ||
|
||
namespace backend.Tests | ||
{ | ||
public class IntegrationTests | ||
{ | ||
|
||
private static readonly Uri Nats = new Uri("localhost:4222/"); | ||
|
||
[Fact] | ||
public void Test() | ||
{ | ||
Assert.True(true); | ||
|
||
DataStorage dataStorage = new DataStorage(); | ||
//MessageHandler messageHandler = new MessageHandler(dataStorage); | ||
|
||
|
||
Uri Nats = new Uri("localhost:4222"); | ||
|
||
var options = ConnectionFactory.GetDefaultOptions(); | ||
options.Url = Nats.OriginalString; | ||
options.User = "admin"; | ||
options.Password = "changeit"; | ||
|
||
EventParser eventParser = new EventParser(dataStorage, options); | ||
|
||
Console.WriteLine(eventParser.dataStorage.servers.Count); | ||
|
||
Assert.Equal(1, eventParser.dataStorage.servers.Count); | ||
//Assert.Equal("2.2.0", messageHandler.dataStorage.servers[0].version); | ||
//Assert.Equal(1, messageHandler.dataStorage.servers[0].proto); | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Client port of 4222 on all interfaces | ||
port: 4222 | ||
|
||
# HTTP monitoring port | ||
monitor_port: 8222 | ||
|
||
# This is for clustering multiple servers together. | ||
cluster { | ||
|
||
# Route connections to be received on any interface on port 6222 | ||
port: 6222 | ||
|
||
|
||
# Routes are actively solicited and connected to from this server. | ||
# This Docker image has none by default, but you can pass a | ||
# flag to the nats-server docker image to create one to an existing server. | ||
routes = [] | ||
} | ||
|
||
|
||
accounts: { | ||
USERS: { | ||
users: [ | ||
{user: a, password: a} | ||
] | ||
}, | ||
SYS: { | ||
users: [ | ||
{user: admin, password: changeit} | ||
] | ||
}, | ||
} | ||
system_account: SYS | ||
|
||
|
||
host: localhost |