chaos-mesh / chaosd

A Chaos Engineering toolkit.
Apache License 2.0
132 stars 64 forks source link

network port occupation using the service mode failed #200

Open wangjiajun-sz opened 2 years ago

wangjiajun-sz commented 2 years ago

chaosd version: Chaosd Version: version.Info{GitVersion:"v1.2.0", GitCommit:"38e871fbcc62ab74dda45f65e13b35aa3b6ee8a8", BuildDate:"2022-04-28T06:18:30Z", GoVersion:"go1.16.2", Compiler:"gc", Platform:"linux/amd64"}

curl -X POST 172.16.112.130:31767/api/attack/network -H "Content-Type:application/json" -d '{"action":"port", "port": 8080}'

{"error":true,"message":"error.api.internal_server_error: json: cannot unmarshal number into Go struct field NetworkCommand.port of type string","code":"error.api.internal_server_error","full_text":"error.api.internal_server_error: json: cannot unmarshal number into Go struct field NetworkCommand.port of type string\n at github.com/chaos-mesh/chaosd/pkg/server/httpserver.(httpServer).createNetworkAttack()\n\t/__w/chaosd/chaosd/pkg/server/httpserver/server.go:159\n at github.com/gin-gonic/gin.(Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/chaos-mesh/chaosd/pkg/server/utils.MWHandleErrors.func1()\n\t/w/chaosd/chaosd/pkg/server/utils/error.go:47\n at github.com/gin-gonic/gin.(Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/gin-gonic/gin.RecoveryWithWriter.func1()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/recovery.go:83\n at github.com/gin-gonic/gin.(Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/gin-gonic/gin.LoggerWithConfig.func1()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/logger.go:241\n at github.com/gin-gonic/gin.(Context).Next()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/context.go:161\n at github.com/gin-gonic/gin.(Engine).handleHTTPRequest()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:409\n at github.com/gin-gonic/gin.(*Engine).ServeHTTP()\n\t/github/home/go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/gin.go:367\n at net/http.serverHandler.ServeHTTP()\n\t/t/go/1.16.2/x64/src/net/http/server.go:2887\n at net/http.(*conn).serve()\n\t/t/go/1.16.2/x64/src/net/http/server.go:1952\n at runtime.goexit()\n\t/t/go/1.16.2/x64/src/runtime/asm_amd64.s:1371"}

Andrewmatilde commented 2 years ago

Try use string.

wangjiajun-sz commented 2 years ago

curl -X POST 10.165.32.26:31767/api/attack/network -H "Content-Type:application/json" -d '{"action":"occupied", "port": "8080"}' 这个命令可以,和官网的描述有出入。 image

Andrewmatilde commented 2 years ago

Thanks for your feadback. That is a doc problem. I will fix it.