Skip to content

Commit

Permalink
all: adjustments package to work with new evaluator
Browse files Browse the repository at this point in the history
encoding/openapi:
- need to use UnifyAccept
- alternative mechansim to recognize formats

encoding/protobuf:
- remove generation of close() calls.

tools/trim:
- need to use UnifyAccept
- a few more changes due to subtle differences

cue/load:
- using new internal API mostly to remove
  dependencies.

error updates:
- changes due to fixes in the evaluator
- error messages are worse for now
  (especially locations)
- Kubernets quick is now failing, but this is due
  to cue correctly catching errors.

Change-Id: I24efdd5eedcf6cd48bae4a6207f96afbdd895c5f
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6658
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Jul 25, 2020
1 parent 7f52c10 commit 0528376
Show file tree
Hide file tree
Showing 94 changed files with 4,816 additions and 7,772 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# Generated by internal/ci/ci_tool.cue; do not edit

name: Test
defaults:
run:
shell: bash
on:
push:
branches:
- '*'
tags-ignore:
- v*
defaults:
run:
shell: bash
jobs:
test:
strategy:
fail-fast: false
matrix:
go-version:
- 1.12.x
- 1.13.x
- 1.14.3
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
Expand All @@ -27,33 +38,22 @@ jobs:
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum')
}}
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Generate
if: matrix.go-version == '1.14.3' && matrix.os != 'windows-latest'
- if: matrix.go-version == '1.14.3' && matrix.os != 'windows-latest'
name: Generate
run: go generate ./...
- name: Test
run: go test ./...
- name: Test with -race
run: go test -race ./...
- name: gorelease check
if: matrix.go-version == '1.14.3' || matrix.go-version == '1.13.x'
- if: matrix.go-version == '1.14.3' || matrix.go-version == '1.13.x'
name: gorelease check
run: go run golang.org/x/exp/cmd/gorelease
- name: Check that git is clean post generate and tests
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
- name: Pull this commit through the proxy on master
if: github.ref == 'refs/heads/master'
- if: github.ref == 'refs/heads/master'
name: Pull this commit through the proxy on master
run: |-
v=$(git rev-parse HEAD)
cd $(mktemp -d)
go mod init mod.com
GOPROXY=https://proxy.golang.org go get -d cuelang.org/go@$v
strategy:
matrix:
go-version:
- 1.12.x
- 1.13.x
- 1.14.3
os:
- ubuntu-latest
- macos-latest
- windows-latest
fail-fast: false
44 changes: 22 additions & 22 deletions .github/workflows/test_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,24 @@
name: Test
env:
GERRIT_COOKIE: ${{ secrets.gerritCookie }}
on:
- repository_dispatch
defaults:
run:
shell: bash
on:
- repository_dispatch
jobs:
start:
runs-on: ubuntu-latest
steps:
- name: Write the gitcookies file
run: echo "$GERRIT_COOKIE" > ~/.gitcookies
- name: Update Gerrit CL message with starting message
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"message":"Started
the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{
github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
}}/review'
test:
needs: start
runs-on: ${{ matrix.os }}
steps:
- name: Write the gitcookies file
Expand All @@ -32,26 +42,28 @@ jobs:
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum')
}}
restore-keys: ${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Generate
if: matrix.go-version == '1.14.3' && matrix.os != 'windows-latest'
- if: matrix.go-version == '1.14.3' && matrix.os != 'windows-latest'
name: Generate
run: go generate ./...
- name: Test
run: go test ./...
- name: Test with -race
run: go test -race ./...
- name: gorelease check
if: matrix.go-version == '1.14.3' || matrix.go-version == '1.13.x'
- if: matrix.go-version == '1.14.3' || matrix.go-version == '1.13.x'
name: gorelease check
run: go run golang.org/x/exp/cmd/gorelease
- name: Check that git is clean post generate and tests
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
- name: Post any failures for this matrix entry
if: ${{ failure() }}
- if: ${{ failure() }}
name: Post any failures for this matrix entry
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"message":"Build
failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url
}}/actions/runs/${{ github.run_id }} for more details","labels":{"Code-Review":-1}}''
-b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID
}}/revisions/${{ github.event.client_payload.commit }}/review'
needs: start
strategy:
fail-fast: false
matrix:
go-version:
- 1.12.x
Expand All @@ -61,20 +73,7 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
fail-fast: false
start:
runs-on: ubuntu-latest
steps:
- name: Write the gitcookies file
run: echo "$GERRIT_COOKIE" > ~/.gitcookies
- name: Update Gerrit CL message with starting message
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"message":"Started
the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{
github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
}}/review'
end:
needs: test
runs-on: ubuntu-latest
steps:
- name: Write the gitcookies file
Expand All @@ -85,3 +84,4 @@ jobs:
}}","labels":{"Code-Review":1}}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
}}/review'
needs: test
4 changes: 1 addition & 3 deletions cmd/cue/cmd/testdata/script/cmd_baddisplay.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
cmp stderr cmd_baddisplay.out

-- cmd_baddisplay.out --
command.baddisplay.display.text: conflicting values 42 and string (mismatched types int and string):
./task_tool.cue:6:9
tool/cli:4:9
command.baddisplay.display: conflicting values 42 and string (mismatched types int and string)
-- task.cue --
package home
message: "Hello world!"
Expand Down
14 changes: 9 additions & 5 deletions cmd/cue/cmd/testdata/script/cmd_dep_cycle.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
! cue cmd cycle
cmp stderr expect-stderr
cmp stderr expect-stderr1
! cue cmd aftercycle
cmp stderr expect-stderr
cmp stderr expect-stderr2
cue cmd interlockedTasks
cmp stdout interlocked-stdout
cmp stderr expect-stderr3

-- expect-stderr --
-- expect-stderr1 --
cyclic dependency in tasks
-- expect-stderr2 --
command.aftercycle: structural cycle
-- expect-stderr3 --
-- interlocked-stdout --
v
v
Expand All @@ -18,8 +22,8 @@ import (
)

command: interlockedTasks: {
t1: cli.Print & { text: ref.value, ref: t2, value: "v" }
t2: cli.Print & { text: ref.value, ref: t1, value: "v" }
t1: cli.Print & { text: t2.value, value: "v" }
t2: cli.Print & { text: t1.value, value: "v" }
}

command: aftercycle: {
Expand Down
2 changes: 1 addition & 1 deletion cmd/cue/cmd/testdata/script/cmd_echo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ command: echo: {
text: echo.stdout
}
}
-- cue.mod --
-- cue.mod --
7 changes: 3 additions & 4 deletions cmd/cue/cmd/testdata/script/cmd_err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
cmp stderr cmd_badfields.out

-- cmd_badfields.out --
command.ref.task.display.contents: invalid bytes argument for field "contents": non-concrete value string|bytes:
./task_tool.cue:6:17
command.ref.task.display.filename: non-concrete value string:
tool/file:9:16
command.ref.task.display.filename: non-concrete value string
command.ref.task.display.contents: invalid bytes argument for field "contents": non-concrete value (string|bytes):
./task_tool.cue:6:8
-- task_tool.cue --
package home

Expand Down
2 changes: 2 additions & 0 deletions cmd/cue/cmd/testdata/script/cmd_notool.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
skip 'error messages'

! cue cmd notool
! stdout .
cmp stderr cmd_baddisplay.out
Expand Down
6 changes: 4 additions & 2 deletions cmd/cue/cmd/testdata/script/cmd_notool2.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
skip 'wrong error message'

! cue notool
! stdout .
cmp stderr cmd_baddisplay.out

-- cmd_baddisplay.out --
command "notool" is not defined
cmd must be run as one of its subcommands: unknown subcommand "notool"
Ensure commands are defined in a "_tool.cue" file.
Run 'cue help' to show available commands.
Run 'cue help cmd' for known subcommands.
-- task.cue --
package home
message: "Hello world!"
Expand Down
14 changes: 4 additions & 10 deletions cmd/cue/cmd/testdata/script/def_jsonschema.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import "strings"
lastName?: strings.MinRunes(1)

// Age in years which must be equal to or greater than zero.
age?: >=0
age?: >=0 & int
...
}
-- schema.json --
Expand Down Expand Up @@ -63,18 +63,12 @@ import "strings"
}
-- expect-stderr --
unsupported constraint "foo":
./bad.json:3:10
./bad.json:3:3
-- data.yaml --
age: twenty

-- expect-stderr2 --
age: conflicting values "twenty" and (int & >=0) (mismatched types string and int):
./data.yaml:1:7
./schema.json:18:15
./schema.json:19:18
age: conflicting values "twenty" and int (mismatched types string and int)
-- expect-stderr3 --
age: conflicting values "twenty" and (int & >=0) (mismatched types string and int):
./data.yaml:1:7
./schema.json:18:15
./schema.json:19:18
age: conflicting values "twenty" and int (mismatched types string and int)
-- cue.mod --
5 changes: 3 additions & 2 deletions cmd/cue/cmd/testdata/script/def_openapi.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
skip 'fix comments and value printing'

cue def openapi+cue: expect-cue-out -o -

cue def foo.cue -o openapi:-
Expand Down Expand Up @@ -257,8 +259,7 @@ package foo

info: {
title: string | *_|_
version: *"v1alpha1" | string
}
version: *"v1alpha1" | string}
#Bar: {
foo: #Foo
...
Expand Down
3 changes: 1 addition & 2 deletions cmd/cue/cmd/testdata/script/eval_e.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ cmp stdout expect-stdout

-- expect-stdout --
-- expect-stderr --
reference "nonExist" not found:
--expression:1:1
reference "nonExist" not found
-- partial.cue --
package exitcode

Expand Down
11 changes: 2 additions & 9 deletions cmd/cue/cmd/testdata/script/eval_errs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@ cmp stdout expect-stdout

-- expect-stdout --
-- expect-stderr --
bar: empty disjunction: conflicting values int and "str" (mismatched types int and string):
./errs.cue:5:10
./errs.cue:6:16
bar: empty disjunction: conflicting values string and 2 (mismatched types string and int):
./errs.cue:5:21
./errs.cue:6:26
x.q: conflicting values "hello" and "goodbye":
./errs.cue:1:4
./errs.cue:2:4
bar.b: conflicting values 2 and string (mismatched types int and string)
x.q: incompatible values "goodbye" and "hello"
-- errs.cue --
a: "hello"
b: "goodbye"
Expand Down
4 changes: 1 addition & 3 deletions cmd/cue/cmd/testdata/script/eval_expr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ cmp stdout expect-stdout
4
-- expect-stderr --
// b.idx
invalid non-ground value string (must be concrete int|string):
./partial.cue:7:9
./partial.cue:8:7
invalid non-ground value string (must be concrete string)
-- partial.cue --
package partial

Expand Down
2 changes: 1 addition & 1 deletion cmd/cue/cmd/testdata/script/eval_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ cmp stdout expect-stdout

-- expect-stdout --
var: {
name: "bar"
env: "staging"
name: "bar"
}
-- tags.cue --
package tags
Expand Down
3 changes: 1 addition & 2 deletions cmd/cue/cmd/testdata/script/export_err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
cmp stdout expect-stdout
cmp stderr expect-stderr
-- expect-stderr --
a.b.2.c: cannot convert incomplete value "int" to JSON:
./exporterr/export_err.cue:4:16
a.b.2.c: cannot convert incomplete value "int" to JSON
-- expect-stdout --
-- exporterr/export_err.cue --
package exporterr
Expand Down
8 changes: 4 additions & 4 deletions cmd/cue/cmd/testdata/script/export_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ cmp stdout expect-stdout
{
"service": [
{
"name": "booster",
"kind": "Service"
"kind": "Service",
"name": "booster"
},
{
"name": "supplement\nfoo",
"kind": "Service",
"name": "supplement\nfoo",
"json": "[1, 2]"
}
],
"deployment": [
{
"name": "booster",
"kind": "Deployment",
"name": "booster",
"replicas": 1
}
]
Expand Down
2 changes: 1 addition & 1 deletion cmd/cue/cmd/testdata/script/export_yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ message: "Hello \(_who)!" // who declared in data.cue

test: {
_foo: string // technically in error, but test anyway.
if len(_foo) > 0 {
if *(len(_foo) > 0) | false {
command: ["foo", "bar"]
}
}
Expand Down

0 comments on commit 0528376

Please sign in to comment.