Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/e2e/onchain_offchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (suite *OnChainOffChainTestSuite) TestStrongDatatypesPrivate() {
}

// Should be rejected as datatype not known
resp, err := PrivateMessage(suite.T(), suite.testState.client1, "topic1", &data, []string{
resp, err := PrivateMessage(suite.testState, suite.testState.client1, "topic1", &data, []string{
suite.testState.org1.Name,
suite.testState.org2.Name,
}, "", fftypes.TransactionTypeBatchPin, true)
Expand All @@ -172,7 +172,7 @@ func (suite *OnChainOffChainTestSuite) TestStrongDatatypesPrivate() {
}
dt = CreateDatatype(suite.T(), suite.testState.client1, dt, true)

resp, err = PrivateMessage(suite.T(), suite.testState.client1, "topic1", &data, []string{
resp, err = PrivateMessage(suite.testState, suite.testState.client1, "topic1", &data, []string{
suite.testState.org1.Name,
suite.testState.org2.Name,
}, "", fftypes.TransactionTypeBatchPin, false)
Expand All @@ -185,7 +185,7 @@ func (suite *OnChainOffChainTestSuite) TestStrongDatatypesPrivate() {
"name": "mywidget"
}`)

resp, err = PrivateMessage(suite.T(), suite.testState.client1, "topic1", &data, []string{
resp, err = PrivateMessage(suite.testState, suite.testState.client1, "topic1", &data, []string{
suite.testState.org1.Name,
suite.testState.org2.Name,
}, "", fftypes.TransactionTypeBatchPin, true)
Expand Down Expand Up @@ -218,7 +218,7 @@ func (suite *OnChainOffChainTestSuite) TestE2EPrivate() {

expectedData[topic] = append(expectedData[topic], data)

resp, err := PrivateMessage(suite.T(), suite.testState.client1, topic, data, []string{
resp, err := PrivateMessage(suite.testState, suite.testState.client1, topic, data, []string{
suite.testState.org1.Name,
suite.testState.org2.Name,
}, "", fftypes.TransactionTypeBatchPin, false)
Expand Down Expand Up @@ -278,7 +278,7 @@ func (suite *OnChainOffChainTestSuite) TestE2EPrivateBlobDatatypeTagged() {

var resp *resty.Response

data, resp, err := PrivateBlobMessageDatatypeTagged(suite.T(), suite.testState.client1, "topic1", []string{
data, resp, err := PrivateBlobMessageDatatypeTagged(suite.testState, suite.testState.client1, "topic1", []string{
suite.testState.org1.Name,
suite.testState.org2.Name,
})
Expand Down Expand Up @@ -330,7 +330,7 @@ func (suite *OnChainOffChainTestSuite) TestE2EWebhookExchange() {
}

var resp *resty.Response
resp, err := PrivateMessage(suite.T(), suite.testState.client1, "topic1", &data, []string{
resp, err := PrivateMessage(suite.testState, suite.testState.client1, "topic1", &data, []string{
suite.testState.org1.Name,
suite.testState.org2.Name,
}, "myrequest", fftypes.TransactionTypeBatchPin, false)
Expand Down Expand Up @@ -385,7 +385,7 @@ func (suite *OnChainOffChainTestSuite) TestE2EWebhookRequestReplyNoTx() {
Value: fftypes.JSONAnyPtr(`{}`),
}

reply := RequestReply(suite.T(), suite.testState.client1, &data, []string{
reply := RequestReply(suite.testState, suite.testState.client1, &data, []string{
suite.testState.org1.Name,
suite.testState.org2.Name,
}, "myrequest", fftypes.TransactionTypeNone)
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/restclient.go → test/e2e/restclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ func BroadcastBlobMessage(t *testing.T, client *resty.Client, topic string) (*ff
return data, res, err
}

func PrivateBlobMessageDatatypeTagged(t *testing.T, client *resty.Client, topic string, orgNames []string) (*fftypes.Data, *resty.Response, error) {
data := CreateBlob(t, client, &fftypes.DatatypeRef{Name: "myblob"})
func PrivateBlobMessageDatatypeTagged(ts *testState, client *resty.Client, topic string, orgNames []string) (*fftypes.Data, *resty.Response, error) {
data := CreateBlob(ts.t, client, &fftypes.DatatypeRef{Name: "myblob"})
members := make([]fftypes.MemberInput, len(orgNames))
for i, oName := range orgNames {
// We let FireFly resolve the friendly name of the org to the identity
Expand All @@ -275,14 +275,14 @@ func PrivateBlobMessageDatatypeTagged(t *testing.T, client *resty.Client, topic
},
Group: &fftypes.InputGroup{
Members: members,
Name: fmt.Sprintf("test_%d", time.Now().Unix()),
Name: fmt.Sprintf("test_%d", ts.startTime.UnixNano()),
},
}).
Post(urlPrivateMessage)
return data, res, err
}

func PrivateMessage(t *testing.T, client *resty.Client, topic string, data *fftypes.DataRefOrValue, orgNames []string, tag string, txType fftypes.TransactionType, confirm bool) (*resty.Response, error) {
func PrivateMessage(ts *testState, client *resty.Client, topic string, data *fftypes.DataRefOrValue, orgNames []string, tag string, txType fftypes.TransactionType, confirm bool) (*resty.Response, error) {
members := make([]fftypes.MemberInput, len(orgNames))
for i, oName := range orgNames {
// We let FireFly resolve the friendly name of the org to the identity
Expand All @@ -301,7 +301,7 @@ func PrivateMessage(t *testing.T, client *resty.Client, topic string, data *ffty
InlineData: fftypes.InlineData{data},
Group: &fftypes.InputGroup{
Members: members,
Name: fmt.Sprintf("test_%d", time.Now().Unix()),
Name: fmt.Sprintf("test_%d", ts.startTime.UnixNano()),
},
}
return client.R().
Expand All @@ -310,7 +310,7 @@ func PrivateMessage(t *testing.T, client *resty.Client, topic string, data *ffty
Post(urlPrivateMessage)
}

func RequestReply(t *testing.T, client *resty.Client, data *fftypes.DataRefOrValue, orgNames []string, tag string, txType fftypes.TransactionType) *fftypes.MessageInOut {
func RequestReply(ts *testState, client *resty.Client, data *fftypes.DataRefOrValue, orgNames []string, tag string, txType fftypes.TransactionType) *fftypes.MessageInOut {
members := make([]fftypes.MemberInput, len(orgNames))
for i, oName := range orgNames {
// We let FireFly resolve the friendly name of the org to the identity
Expand All @@ -328,16 +328,16 @@ func RequestReply(t *testing.T, client *resty.Client, data *fftypes.DataRefOrVal
InlineData: fftypes.InlineData{data},
Group: &fftypes.InputGroup{
Members: members,
Name: fmt.Sprintf("test_%d", time.Now().Unix()),
Name: fmt.Sprintf("test_%d", ts.startTime.UnixNano()),
},
}
var replyMsg fftypes.MessageInOut
resp, err := client.R().
SetBody(msg).
SetResult(&replyMsg).
Post(urlRequestMessage)
require.NoError(t, err)
require.Equal(t, 200, resp.StatusCode(), "POST %s [%d]: %s", urlUploadData, resp.StatusCode(), resp.String())
require.NoError(ts.t, err)
require.Equal(ts.t, 200, resp.StatusCode(), "POST %s [%d]: %s", urlUploadData, resp.StatusCode(), resp.String())
return &replyMsg
}

Expand Down