Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

add local testing of json schema generation #316

Merged
merged 1 commit into from
Oct 12, 2017

Conversation

surajssd
Copy link
Member

@surajssd surajssd commented Oct 6, 2017

No description provided.

@ashetty1
Copy link
Collaborator

ashetty1 commented Oct 9, 2017

Tested it and it works

@surajssd
Copy link
Member Author

surajssd commented Oct 9, 2017

@ashetty1 thanks!

@surajssd
Copy link
Member Author

@kadel ping

Makefile Outdated
@@ -86,7 +86,7 @@ endif

# Run all tests
.PHONY: test
test: test-dep validate test-unit
test: test-dep validate test-unit test-jsonschema-generation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should not be included.

This suddenly uses a Docker container.

Similar to how we have integration tests / unit tests / cmd tests separated into their separate commands.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not safe to assume that the kedge developers have docker installed locally?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it's not safe, and tests should be ran separately... testing json-schema-generation should be separate just like test-unit, test-ci, test-cmd, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done changes as requested!

@surajssd surajssd force-pushed the json-schema-gen-test branch 2 times, most recently from b61a9d2 to 946fe79 Compare October 12, 2017 08:49
@surajnarwade
Copy link
Collaborator

if I run it locally, I get following error:

$ make test-jsonschema-generation 
docker run -v `pwd`/pkg/spec/spec.go:/data/spec.go:ro,Z surajd/kedgeschema
+ curl https://raw.githubusercontent.com/kedgeproject/json-schema-generator/master/scripts/k8s-release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    12  100    12    0     0     12      0  0:00:01 --:--:--  0:00:01    22
+ curl -O https://raw.githubusercontent.com/kubernetes/kubernetes/release-1.7/api/openapi-spec/swagger.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1776k  100 1776k    0     0    423      0  1:11:40  1:11:36  0:00:04 1023k
+ curl -O https://raw.githubusercontent.com/kedgeproject/kedge/master/pkg/spec/spec.go
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file spec.go: Read-only file system
 25  7696   25  1925    0     0   1925      0  0:00:03 --:--:--  0:00:03  3493
curl: (23) Failed writing body (0 != 1925)
Makefile:125: recipe for target 'test-jsonschema-generation' failed
make: *** [test-jsonschema-generation] Error 23

@surajnarwade
Copy link
Collaborator

using sudo in travis will work (for docker)

@surajssd
Copy link
Member Author

@surajnarwade

if I run it locally, I get following error:

for some reason curl seemed to fail in there

using sudo in travis will work (for docker)

yes added sudo in front of docker command and also added sudo: required in travis config file

Makefile Outdated
# Test if the changed spec.go is valid and JSONSchema can be generated out of it
.PHONY: test-jsonschema-generation
test-jsonschema-generation:
sudo docker run -v `pwd`/pkg/spec/spec.go:/data/spec.go:ro,Z surajd/kedgeschema
Copy link
Collaborator

@cdrage cdrage Oct 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having anything "sudo" within Makefile is really bad...

Please remove sudo! If a user wishes to run test-jsonschema-generation they can use make test-jsonschema-generation

see other comment, after adding:

sudo: required

services:
  - docker

you wont need to sudo the docker command anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved!

@@ -1,5 +1,7 @@
dist: trusty

sudo: required
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will need to add docker as a service to here too:

sudo: required

services:
  - docker

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks!

@cdrage
Copy link
Collaborator

cdrage commented Oct 12, 2017

Other than SemaphoreCI test failing, LGTM!

@cdrage cdrage merged commit a20308e into kedgeproject:master Oct 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants