Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master broken: unable to validate: open /config-schema.json: no such file or directory #23

Open
philips opened this issue Sep 21, 2016 · 6 comments

Comments

@philips
Copy link
Contributor

philips commented Sep 21, 2016

From @wking on June 21, 2016 3:17

This is probably due to the floating dependencies without #148, but recent builds in a clean Go directory break with:

$ make test
go test -race ./...
?       github.com/opencontainers/image-spec/cmd/oci-image-tool [no test files]
?       github.com/opencontainers/image-spec/image      [no test files]
--- FAIL: TestConfig (0.00s)
        config_test.go:162: test 6: expected validation failure false but got true, err schema application/vnd.oci.image.serialization.config.v1+json: unable to validate: open /config-schema.json: no such file or directory
…

Copied from original issue: opencontainers/image-spec#162

@philips
Copy link
Contributor Author

philips commented Sep 21, 2016

From @wking on June 21, 2016 3:26

Spun off from earlier discussion in #161.

@philips
Copy link
Contributor Author

philips commented Sep 21, 2016

From @wking on June 21, 2016 4:0

And the problem is (not surprisingly, given the error message) with http/FileSystem (see discussion in #150). The tests pass with the following patch:

diff --git a/schema/validator.go b/schema/validator.go
index abc8d6d..537314a 100644
--- a/schema/validator.go
+++ b/schema/validator.go
@@ -19,6 +19,7 @@ import (
    "fmt"
    "io"
    "io/ioutil"
+   "path/filepath"

    "github.com/pkg/errors"
    "github.com/xeipuuv/gojsonschema"
@@ -44,7 +45,12 @@ func (v Validator) Validate(src io.Reader) error {
        return errors.Wrap(err, "unable to read manifest")
    }

-   sl := gojsonschema.NewReferenceLoaderFileSystem("file:///"+specs[v], fs)
+   //sl := gojsonschema.NewReferenceLoaderFileSystem("file:///"+specs[v], fs)
+   refPath, err := filepath.Abs(specs[v])
+   if err != nil {
+       return err
+   }
+   sl := gojsonschema.NewReferenceLoader("file://" + refPath)
    ml := gojsonschema.NewStringLoader(string(buf))

    result, err := gojsonschema.Validate(sl, ml)

@philips
Copy link
Contributor Author

philips commented Sep 21, 2016

From @wking on June 21, 2016 4:13

Rolling back assorted dependencies, the issue was introduced by xeipuuv/gojsonschema#103, and there are already comments there about broken loading as a result. So folks who want a working test suite should pin thier gojsonschema before that PR landed or wait until they roll out a fix.

@philips
Copy link
Contributor Author

philips commented Sep 21, 2016

From @vbatts on June 21, 2016 14:10

correct. rolling back xeipuuv/gojsonschema@ac948b6 lets the tests pass again. :-\

@philips
Copy link
Contributor Author

philips commented Sep 21, 2016

From @petemoore on June 21, 2016 17:43

I think xeipuuv/gojsonschema#105 fixed a bug introduced in xeipuuv/gojsonschema#103 - so you might not need to pin anymore...

@philips
Copy link
Contributor Author

philips commented Sep 21, 2016

From @vbatts on June 21, 2016 17:45

nope. 105 did not fix the issue.

On Tue, Jun 21, 2016 at 1:43 PM, Pete Moore [email protected]
wrote:

I think xeipuuv/gojsonschema#105
xeipuuv/gojsonschema#105 fixed a bug introduced
in xeipuuv/gojsonschema#103
xeipuuv/gojsonschema#103 - so you might not
need to pin anymore...


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
opencontainers/image-spec#162 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAEF6eMLXQhr52m7X1lzPZ_pGd7uyoU9ks5qOCLFgaJpZM4I6Uyb
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant