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 #162

Closed
wking opened this issue Jun 21, 2016 · 7 comments

Comments

@wking
Copy link
Contributor

wking commented Jun 21, 2016

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
…
@wking
Copy link
Contributor Author

wking commented Jun 21, 2016

Spun off from earlier discussion in #161.

@wking
Copy link
Contributor Author

wking commented Jun 21, 2016

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)

@wking
Copy link
Contributor Author

wking commented Jun 21, 2016

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.

@vbatts
Copy link
Member

vbatts commented Jun 21, 2016

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

@petemoore
Copy link

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

@vbatts
Copy link
Member

vbatts commented Jun 21, 2016

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
#162 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAEF6eMLXQhr52m7X1lzPZ_pGd7uyoU9ks5qOCLFgaJpZM4I6Uyb
.

@philips
Copy link
Contributor

philips commented Sep 21, 2016

This issue was moved to opencontainers/image-tools#23

@philips philips closed this as completed Sep 21, 2016
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

4 participants