Commit 67e83341 authored by David Stainton's avatar David Stainton

Add optional docker tests

parent 96bea099
Pipeline #971 failed with stage
in 10 minutes and 54 seconds
......@@ -11,6 +11,21 @@ Katzenpost Mix Network Client Library
=====================================
optional docker tests
---------------------
To run the option docker tests firstly, see our docker repo
and start your local dockerized mix network:
https://github.com/katzenpost/docker
A couple of minutes after startup run the following commands:
::
GORACE=history_size=7 go test -v -tags=docker_test -race -run TestClientBlockingSendReceive
GORACE=history_size=7 go test -v -tags=docker_test -race -run TestClientBlockingSendReceiveWithDecoyTraffic
license
=======
......
// client_docker_test.go - optional client docker test
// Copyright (C) 2019 David Stainton.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// +build docker_test
package client
import (
"testing"
"github.com/katzenpost/client/config"
"github.com/katzenpost/core/utils"
"github.com/stretchr/testify/require"
)
func TestClientBlockingSendReceive(t *testing.T) {
require := require.New(t)
// Load catshadow config file.
cfg, err := config.LoadFile("testdata/client.toml")
require.NoError(err)
cfg, linkKey := AutoRegisterRandomClient(cfg)
client, err := New(cfg)
require.NoError(err)
session, err := client.NewSession(linkKey)
require.NoError(err)
desc, err := session.GetService("loop")
require.NoError(err)
reply, err := session.BlockingSendUnreliableMessage(desc.Name, desc.Provider, []byte("hello"))
require.NoError(err)
require.True(utils.CtIsZero(reply))
}
func TestClientBlockingSendReceiveWithDecoyTraffic(t *testing.T) {
require := require.New(t)
// Load catshadow config file.
cfg, err := config.LoadFile("testdata/client.toml")
require.NoError(err)
cfg, linkKey := AutoRegisterRandomClient(cfg)
cfg.Debug.DisableDecoyTraffic = false
client, err := New(cfg)
require.NoError(err)
session, err := client.NewSession(linkKey)
require.NoError(err)
desc, err := session.GetService("loop")
require.NoError(err)
reply, err := session.BlockingSendUnreliableMessage(desc.Name, desc.Provider, []byte("hello"))
require.NoError(err)
require.True(utils.CtIsZero(reply))
}
[UpstreamProxy]
Type = "none"
[Logging]
Disable = false
Level = "DEBUG"
File = ""
[NonvotingAuthority]
Address = "127.0.0.1:29483"
PublicKey = "o4w1Nyj/nKNwho5SWfAIfh7SMU8FRx52nMHGgYsMHqQ="
[Debug]
DisableDecoyTraffic = true
CaseSensitiveUserIdentifiers = false
PollingInterval = 1
[Panda]
Receiver = "+panda"
Provider = "provider1"
BlobSize = 1000
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment