'Creates test registering the first two instances with a load balancer.
Assumes that create_instances test has been run to add
the instances. Note by design these were in two different zones
but same region as required by the API this is testing.
Assumes that upsert_load_balancer has been run to
create the load balancer itself.
Returns:
st.OperationContract'

def register_load_balancer_instances(self):

    payload = self.agent.type_to_payload('registerInstancesWithGoogleLoadBalancerDescription', {'loadBalancerNames': [self.__use_lb_name], 'instanceIds': self.use_instance_names[:2], 'region': self.bindings['TEST_GCE_REGION'], 'credentials': self.bindings['SPINNAKER_GOOGLE_ACCOUNT']})
    builder = gcp.GcpContractBuilder(self.gcp_observer)
    builder.new_clause_builder('Instances    in    Target    Pool', retryable_for_secs=15).list_resource('targetPools').EXPECT(ov_factory.value_list_contains(jp.DICT_MATCHES({'name': jp.STR_SUBSTR(self.__use_lb_tp_name), 'instances': jp.LIST_MATCHES([jp.STR_SUBSTR(self.use_instance_names[0]), jp.STR_SUBSTR(self.use_instance_names[1])])}))).AND(ov_factory.value_list_excludes(jp.DICT_MATCHES({'name': jp.STR_SUBSTR(self.__use_lb_tp_name), 'instances': jp.LIST_MATCHES([jp.STR_SUBSTR(self.use_instance_names[2])])})))
    return st.OperationContract(self.new_post_operation(title='register_load_balancer_instances', data=payload, path='ops'), contract=builder.build())
