![](/img/trans.png)
[英]Can I run Selenium tests when hosts file does not have localhost alias?
[英]Kubernetes Serenety Tests Ingress does not work with localhost
我目前正在进行本地 e2e 测试。
设置:
为了清楚起见并且因为我们将使用不同的阶段,我们希望在我们所有的 e2e 项目中将重定向 url 结尾从“测试”更改为“本地主机”。
主机文件条目
当前的
[MY IP 地址] e2e.myproject.testing
成为
[MY IP 地址] e2e.myproject.localhost
这
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
labels:
app: my-webclient
name: my-webclient
namespace: somenamespace
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
nginx.ingress.kubernetes.io/app-root: "/app/"
spec:
rules:
- host: e2e.myproject.localhost
http:
paths:
- backend:
serviceName: my-myproject
servicePort: 8080
pathType: ImplementationSpecific
status:
loadBalancer:
ingress:
- hostname: localhost
有趣的事实:如果我在 url 和部署文件中使用后缀“testing”、“foobar”、“deadbeef”运行测试,一切正常。 如果我用“localhost”替换它,它就不起作用。 我收到连接错误。
理论:在主机文件中使用“localhost”以外的任何东西作为重定向uri,入口指向我机器的 ip。 但是,如果我使用 localhost ,则入口或部署指向它们正在运行的虚拟机的 ip。
任何人都可以验证并知道解决方案吗? 也可能解决我们遇到的一些相关问题^^'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.