rancher / rio

Application Deployment Engine for Kubernetes
https://rio.io
Apache License 2.0
2.27k stars 228 forks source link

Test Riofile Parsing #532

Open cbron opened 5 years ago

cbron commented 5 years ago

The Riofile will have special syntax for things like routing. We should have automated tests to ensure we can parse those variants as well as the rest of the manifest.

See:

davidnuzik commented 5 years ago

@cbron to revisit after the incoming rc and reassess.

daxmc99 commented 4 years ago

This riofile causes a panic

services:
    emoji-svc:
        app: emoji-svc
        version: v0
        image: buoyantio/emojivoto-emoji-svc:v8
        ports:
        - 8080:8080/grpc,grpc
        env:
        - GRPC_PORT=8080

    voting-svc:
        app: voting-svc
        version: v0
        image: buoyantio/emojivoto-voting-svc:v8
        ports:
        - 8080:8080/grpc,grpc
        env:
        - GRPC_PORT=8080

    web-svc:
        app: web-svc
        version: v0
        image: buoyantio/emojivoto-web:v8
        ports:
            - 80:8080/http,web
        env:
        - WEB_PORT=8080
        - EMOJISVC_HOST=emoji-svc:8080
        - VOTINGSVC_HOST=voting-svc:8080
        - INDEX_BUNDLE=dist/index_bundle.js 

    vote-bot:
        app: vote-bot
        version: v0
        image: buoyantio/emojivoto-web:v8
        command:
        - emojivoto-vote-bot
        env:
        - WEB_HOST=web-svc:80

configs:
    config-foo:
    key1: |-
        I'm providing some data to your rio apps

routers:
    rio-router:
        to:
        - service: web-svc
          revision: v0
          namespace: default

stack trace

default:stack/rio-demo
panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/rancher/norman/pkg/types/mapper.SetValue.ToInternal(...)
        /Users/dax/go/pkg/mod/github.com/rancher/norman@v0.0.0-20191030191625-ebecbda5fbe3/pkg/types/mapper/set_value.go:22
github.com/rancher/norman/pkg/types.Mappers.ToInternal(0xc0003b7f40, 0xa, 0xa, 0x0, 0xc000542010, 0x0)
        /Users/dax/go/pkg/mod/github.com/rancher/norman@v0.0.0-20191030191625-ebecbda5fbe3/pkg/types/mapper.go:40 +0x8f
github.com/rancher/norman/pkg/types.Mappers.ToInternal(0xc00057fd40, 0x2, 0x2, 0x0, 0xc000542000, 0x0)
        /Users/dax/go/pkg/mod/github.com/rancher/norman@v0.0.0-20191030191625-ebecbda5fbe3/pkg/types/mapper.go:40 +0x8f
github.com/rancher/norman/pkg/types.Mappers.ToInternal(0xc00054e040, 0x2, 0x2, 0x0, 0x0, 0x0)
        /Users/dax/go/pkg/mod/github.com/rancher/norman@v0.0.0-20191030191625-ebecbda5fbe3/pkg/types/mapper.go:40 +0x8f
github.com/rancher/norman/pkg/types.(*typeMapper).ToInternal(0xc000128eb0, 0x0, 0xc0004344f8, 0x1)
        /Users/dax/go/pkg/mod/github.com/rancher/norman@v0.0.0-20191030191625-ebecbda5fbe3/pkg/types/mapper.go:94 +0x7c
github.com/rancher/norman/pkg/types.(*typeMapper).ToInternal(0xc0002e0050, 0xc00077ad80, 0x7, 0xc00096b101)
        /Users/dax/go/pkg/mod/github.com/rancher/norman@v0.0.0-20191030191625-ebecbda5fbe3/pkg/types/mapper.go:110 +0x485
github.com/rancher/rio/pkg/riofile.Parse(0xc000142900, 0x45b, 0x480, 0xc00096b140, 0xc000924030, 0x59c2d49, 0x4)
        /Users/dax/work/rio/src/github.com/rancher/rio/pkg/riofile/riofile.go:155 +0x19e
github.com/rancher/rio/pkg/stack.(*Stack).GetObjects(0xc000434c90, 0x59d4a96, 0x10, 0xc000756ea0, 0x5cd1320, 0x59d09a2)
        /Users/dax/work/rio/src/github.com/rancher/rio/pkg/stack/stack.go:85 +0x75
github.com/rancher/rio/pkg/stack.(*Stack).GetImageBuilds(0xc000434c90, 0xc000142480, 0x45b, 0xc000142900)
        /Users/dax/work/rio/src/github.com/rancher/rio/pkg/stack/stack.go:105 +0x43
github.com/rancher/rio/cli/cmd/up.(*Up).up(0xc00017e7e0, 0xc000142480, 0x45b, 0x0, 0xc000505380, 0xc000651a40, 0x0, 0x0)
        /Users/dax/work/rio/src/github.com/rancher/rio/cli/cmd/up/up.go:120 +0xe9
github.com/rancher/rio/cli/cmd/up.(*Up).Run(0xc00017e7e0, 0xc000651a40, 0x6ce25e0, 0xc00028f0e0)
        /Users/dax/work/rio/src/github.com/rancher/rio/cli/cmd/up/up.go:57 +0x166
github.com/rancher/rio/cli/pkg/builder.Command.func1(0xc000651a40, 0xc0002b76b0, 0x59c54f3)
        /Users/dax/work/rio/src/github.com/rancher/rio/cli/pkg/builder/builder.go:148 +0x91
github.com/rancher/rio/cli/pkg/clicontext.Wrap.func1(0xc000212420, 0x0, 0xc0005aa090)
        /Users/dax/work/rio/src/github.com/rancher/rio/cli/pkg/clicontext/clicontext.go:29 +0x9d
github.com/urfave/cli.HandleAction(0x56d5a20, 0xc0003d40a0, 0xc000212420, 0xc000212420, 0x0)
        /Users/dax/go/pkg/mod/github.com/urfave/cli@v1.22.1/app.go:523 +0xbe
github.com/urfave/cli.Command.Run(0xc0003bda2a, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x59d40a6, 0x10, 0xc0003bda90, ...)
        /Users/dax/go/pkg/mod/github.com/urfave/cli@v1.22.1/command.go:174 +0x51c
github.com/urfave/cli.(*App).Run(0xc0000348c0, 0xc00000e060, 0x2, 0x2, 0x0, 0x0)
        /Users/dax/go/pkg/mod/github.com/urfave/cli@v1.22.1/app.go:276 +0x718
main.main()
        /Users/dax/work/rio/src/github.com/rancher/rio/cli/main.go:233 +0x24d0
cbron commented 4 years ago

^ fix: https://github.com/rancher/norman/pull/321