在其上运行macOS和docker ubuntu,我无法ping我的本地网络的IP地址.以下是我的docker容器的网络配置.我可以ping我的主机的IP地址,但我无法访问本地网络上的其他IP地址.
root# ping 172.17.101.192
PING 172.17.101.192 (172.17.101.192) 56(84) bytes of data.
From 172.17.0.3 icmp_seq=1 Destination Host Unreachable
From 172.17.0.3 icmp_seq=2 Destination Host Unreachable
root# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:ac:11:00:03
inet addr:172.17.0.3 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::42:acff:fe11:3/64 Scope:Link
Run Code Online (Sandbox Code Playgroud)
是否有任何网络配置可以帮助我执行此操作?
我试过net=host但它没有帮助它.
尝试使用api回调模拟其中一个功能,并得到如下错误 TypeError: specificMockImpl.apply is not a function
import { IEnvironmentMap, load } from 'dotenv-extended';
import { getTokensWithAuthCode, sdk } from '../src/connection-manager';
describe('getTokensWithAuthCode function Tests', () => {
jest.useFakeTimers();
let boxConfig: IEnvironmentMap;
beforeAll(() => {
boxConfig = load({
errorOnMissing: true,
});
});
it('should reject a promise if there is wrong auth code provided', async () => {
sdk.getTokensAuthorizationCodeGrant = jest.fn().mockImplementation(boxConfig.BOX_AUTH_CODE, null, cb => {
cb('Error', null);
});
try {
const tokens = await getTokensWithAuthCode();
} catch (error) {
expect(error).toBe('Error');
}
}); …Run Code Online (Sandbox Code Playgroud) 我的脚本由随机生成参数的程序调用,例如
input=12 output=14 destinationroute=10.0.0.0
Run Code Online (Sandbox Code Playgroud)
然后使用生成的参数调用我的脚本:
./getroute.sh input=12 output=14 destinationroute=10.0.0.0
Run Code Online (Sandbox Code Playgroud)
脚本里面是这样的:
#!/bin/bash
input=$1
output=$2
destinationroute=$3
...
Run Code Online (Sandbox Code Playgroud)
该程序总是以随机顺序调用参数(例如,输入=12 输出=14 或输出=14 输入=12),并且我无法更改程序。
有什么方法可以识别正确的参数并将它们放在适当的位置。
bash ×1
docker ×1
javascript ×1
jest ×1
macos ×1
networking ×1
shell ×1
typescript ×1
ubuntu ×1