Hey, I'm doing some testes regarding which situati...
# protobufs
v
Hey, I'm doing some testes regarding which situations the Provider test fails, and seems that when I remove a field from the Provider version of Protobuff, this do not break the contract testing (even if I put it on Consumer specification). For example, my consumer proto msg :
Copy code
protoMessage := `{
		"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:
Copy code
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):
Copy code
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?