describe('InetAddress', () => { it('should have correct type', () => { const addr: InetAddress = new InetAddress('80.91.37.133'); expect(addr.ipv4).to.be.a('function'); }); });
// This doesn't eagerly reference the server URL, as it isn't available until "before all" constructor({ app, testTracer, routeBasedSpanName, addTag }) { this._app = app; this._testTracer = testTracer; this._routeBasedSpanName = routeBasedSpanName; this._addTag = addTag; this._localServiceName = testTracer.tracer().localEndpoint.serviceName; this._ipv4 = InetAddress.getLocalAddress().ipv4(); }
function toThriftEndpoint(endpoint) { if (endpoint === undefined) { return undefined; } var res = new thriftTypes.Endpoint({ service_name: endpoint.serviceName || '' // undefined is not allowed in v1 }); if (endpoint.ipv4) { res.ipv4 = new InetAddress(endpoint.ipv4).toInt(); } else { res.ipv4 = 0; // undefined not allowed in v1 thrift } if (endpoint.port) { res.port = endpoint.port; } return res; }
describe('[ClientAddr, ServerAddr, MessageAddr, LocalAddr]', () => { it('should return correct type', () => { const clientAddr: Annotation.ClientAddr = new Annotation.ClientAddr({ host: InetAddress.getLocalAddress(), port: 8000 }); const serverAddr: Annotation.ServerAddr = new Annotation.ServerAddr({ serviceName: 'name', host: InetAddress.getLocalAddress(), port: 8000 }); const MessageAddr: Annotation.MessageAddr = new Annotation.MessageAddr({ serviceName: 'name', host: InetAddress.getLocalAddress(), port: 8000 }); const localAddr: Annotation.LocalAddr = new Annotation.LocalAddr({ host: InetAddress.getLocalAddress(), port: 8000 }); expect(clientAddr).to.have.property('annotationType'); expect(serverAddr).to.have.property('serviceName'); expect(MessageAddr).to.have.property('serviceName'); expect(localAddr).to.have.property('host'); }); });
describe('InetAddress', () => { it('should have correct type', () => { const addr: InetAddress = new InetAddress('80.91.37.133'); expect(addr.ipv4).to.be.a('function'); }); });
function toThriftEndpoint(endpoint) { if (endpoint === undefined) { return undefined; } var res = new thriftTypes.Endpoint({ service_name: endpoint.serviceName || '' // undefined is not allowed in v1 }); if (endpoint.ipv4) { res.ipv4 = new InetAddress(endpoint.ipv4).toInt(); } else { res.ipv4 = 0; // undefined not allowed in v1 thrift } if (endpoint.port) { res.port = endpoint.port; } return res; }
function toThriftEndpoint(endpoint) { if (endpoint === undefined) { return undefined; } const res = new thriftTypes.Endpoint({ service_name: endpoint.serviceName || '', // undefined is not allowed in v1 }); if (endpoint.ipv4) { res.ipv4 = new InetAddress(endpoint.ipv4).toInt(); } else { res.ipv4 = 0; // undefined not allowed in v1 thrift } if (endpoint.port) { res.port = endpoint.port; } return res; }
describe('[ClientAddr, ServerAddr, MessageAddr, LocalAddr]', () => { it('should return correct type', () => { const clientAddr: Annotation.ClientAddr = new Annotation.ClientAddr({ host: InetAddress.getLocalAddress(), port: 8000 }); const serverAddr: Annotation.ServerAddr = new Annotation.ServerAddr({ serviceName: 'name', host: InetAddress.getLocalAddress(), port: 8000 }); const MessageAddr: Annotation.MessageAddr = new Annotation.MessageAddr({ serviceName: 'name', host: InetAddress.getLocalAddress(), port: 8000 }); const localAddr: Annotation.LocalAddr = new Annotation.LocalAddr({ host: InetAddress.getLocalAddress(), port: 8000 }); expect(clientAddr).to.have.property('annotationType'); expect(serverAddr).to.have.property('serviceName'); expect(MessageAddr).to.have.property('serviceName'); expect(localAddr).to.have.property('host'); }); });