Add tests for returning mapped ports of runners

This commit is contained in:
sirkrypt0
2021-07-07 15:35:30 +02:00
parent 64764a9809
commit 2f1383b743
5 changed files with 109 additions and 4 deletions

View File

@@ -25,6 +25,14 @@ func TestIdIsStored(t *testing.T) {
assert.Equal(t, tests.DefaultJobID, runner.ID())
}
func TestMappedPortsAreStoredCorrectly(t *testing.T) {
runner := NewNomadJob(tests.DefaultJobID, tests.DefaultPortMappings, nil, nil)
assert.Equal(t, tests.DefaultMappedPorts, runner.MappedPorts())
runner = NewNomadJob(tests.DefaultJobID, nil, nil, nil)
assert.Empty(t, runner.MappedPorts())
}
func TestMarshalRunner(t *testing.T) {
runner := NewNomadJob(tests.DefaultJobID, nil, nil, nil)
marshal, err := json.Marshal(runner)