我知道 minikube 应该仅用于本地,但我想为我的应用程序创建一个测试环境。
为了做到这一点,我希望将 minikube 集群内运行的应用程序公开给外部访问(从公共互联网上的任何设备 - 例如 4G 智能手机)。
注意:我运行 minikube--driver=docker
kubectl 获取服务
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
web8080 NodePort 10.99.39.162 <none> 8080:31613/TCP 3d1h
Run Code Online (Sandbox Code Playgroud)
迷你库贝 IP
192.168.49.2
Run Code Online (Sandbox Code Playgroud)
一种方法如下:
firewall-cmd --add-port=8081/tcp
kubectl port-forward --address 0.0.0.0 services/web8080 8081:8080
Run Code Online (Sandbox Code Playgroud)
然后我可以使用以下方式访问它:
curl localhost:8081 (directly from the machine running the cluster inside a VM)
curl 192.168.x.xx:8081 (from my Mac in same network - this is the private ip of the machine running the cluster inside a VM)
curl 84.xxx.xxx.xxx:8081 (from a …Run Code Online (Sandbox Code Playgroud) 请注意,我使用的是 Kotlin。
另请注意,我有一个多模块应用程序。
我通过运行该类成功从 IDE 运行 Cucumber 测试RunCukesTest.kt。
我的问题是,当我运行命令时mvn test,RunCukesTest.kt似乎没有运行,并且没有.feature经过测试。
我不确定是否需要配置maven-surefire-plugin才能使其工作。
域-pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>smart-notes</artifactId>
<groupId>xxx</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>domain</artifactId>
<properties>
<cucumber.version>4.4.0</cucumber.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.12</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)
父pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>domain</module>
<module>infra</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> …Run Code Online (Sandbox Code Playgroud)