summaryrefslogtreecommitdiff
path: root/plugins/jobs/broker/amqp/job_test.go
blob: 24ca453b185a281a759671fd60ef3020be10926c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package amqp

import (
	"github.com/streadway/amqp"
	"github.com/stretchr/testify/assert"
	"testing"
)

func Test_Unpack_Errors(t *testing.T) {
	_, _, _, err := unpack(amqp.Delivery{
		Headers: map[string]interface{}{},
	})
	assert.Error(t, err)

	_, _, _, err = unpack(amqp.Delivery{
		Headers: map[string]interface{}{
			"rr-id": "id",
		},
	})
	assert.Error(t, err)

	_, _, _, err = unpack(amqp.Delivery{
		Headers: map[string]interface{}{
			"rr-id":      "id",
			"rr-attempt": int64(0),
		},
	})
	assert.Error(t, err)
}