Vinicius Gabriel
12/07/2023, 2:55 PMprotoMessage := `{
"pact:proto": "` + path + `",
"pact:message-type": "CreateAccountMessage",
"pact:content-type": "application/protobuf",
"pact:protobuf-config": {
"additionalIncludes": [
"/Users/viniciusgabriel/Projects/common/proto"
]
},
"is_migration": "matching(boolean, true)",
"account_type": "matching(type, 'SelfDirected')",
"account_info": {
"account_id": "eachValue(matching(type, 10))",
"message_id": "eachValue(matching(type, 10))",
"reg_form": {
"reg_form": "matching(boolean, false)",
"reg_form_sign": "notEmpty('sign')",
"signed_at": {
"seconds": "matching(integer, 100)",
"nanos": "matching(integer, 100)"
}
}
}
}`
I removed the is_migration
field from Protobuff used on Provider side:
Test:
functionMappings := message.Handlers{
"CreateAccountMessage": func([]models.ProviderState) (message.Body, message.Metadata, error) {
msg, _ := proto.Marshal(&proto.CreateAccountMessage{
// IsMigration: true,
AccountType: sfproto.AccountType_SelfDirected,
AccountInfo: &proto.AccountMessage{
RegForm: &sfproto.RegForm{
RegFormSign: "sign",
},
},
})
return msg, message.Metadata{
"contentType": "application/protobuf;message=CreateAccountMessage",
}, nil
},
}
Protobuff code update (used on Provider side):
type CreateAccountMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
AccountInfo *AccountMessage `protobuf:"bytes,1,opt,name=account_info,json=accountInfo,proto3" json:"account_info,omitempty"`
AccountType sfproto.ApexAccountType `protobuf:"varint,3,opt,name=account_type,json=accountType,proto3,enum=bridges.AccountType" json:"account_type,omitempty"`
}
When I run the provider test, is not expected the test break, because a field that one Consumer expect do not exist anymore?