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

(TASK #1) Adding Service Functionality #167

Merged
merged 2 commits into from
May 29, 2018
Merged

(TASK #1) Adding Service Functionality #167

merged 2 commits into from
May 29, 2018

Conversation

peeyush1234
Copy link
Contributor

@peeyush1234 peeyush1234 commented May 23, 2018

This is the first commit in the series of commits for adding Kong 0.13.X support.

This change adds the functionality for creating, listing, deleting and updating the Kong Services

Next Steps:
Task #2 - Adding Routes Functionality
Task #3 - Plugins integration for Services and Routes

Copy link
Owner

@PGBI PGBI left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, it's awesome, especially since you took time to write tests.

I just have a few minor comments. I'll merge this PR when they are addressed.

<div class="card-panel teal lighten-2">
<h5 class="white-text">
<i class="material-icons small">highlight</i>
What's an Service?
Copy link
Owner

Choose a reason for hiding this comment

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

Typo: "What's a Service?"

Copy link
Contributor Author

@peeyush1234 peeyush1234 May 28, 2018

Choose a reason for hiding this comment

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

Updated

<table class="bordered" ng-show="total > 0">
<thead>
<tr>
<th ng-repeat="prop in env.schemas.service.properties">{{prop.display_name}}</th>
Copy link
Owner

@PGBI PGBI May 26, 2018

Choose a reason for hiding this comment

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

I wouldn't display all the information of a Service on this page. This leads to many columns and isn't very readable.

This is what it looks like in my browser:
capture d ecran 2018-05-26 a 12 25 52

I would collapse "protocol", "host", "port" and "path" into the single column named "url" (which is empty by the way), and not display "updated at", "created at", and the various options (retry, timeouts...). The user can still click edit to see the details of a given Service.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the various options as suggested.

However, I did not collapse protocol, host, port, and path into URL since the user experience is better now after removing options. Please let me know if you think otherwise.

screen shot 2018-05-28 at 8 50 23 am

Copy link
Owner

Choose a reason for hiding this comment

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

Looks good to me

<a href="#!/services" class="waves-effect">
<i class="material-icons">dvr</i> Services
</a>
</li>
<li>
<a href="#!/apis" class="waves-effect">
<i class="material-icons">apps</i> APIs
Copy link
Owner

Choose a reason for hiding this comment

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

If env.schemas.service exists, I think you can add "(deprecated)" after "APIs".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


describe('Service Creation testing', () => {
// Only run tests if the Kong version is 0.13 as Services are supported in version 0.13 only
if (process.env.KONG_VERSION === '0.13') {
Copy link
Owner

Choose a reason for hiding this comment

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

Here you'll want to check if Kong version is 0.13 or higher.

You can use semver for that:

var semver = require('semver');
if (semver.lt(process.env.KONG_VERSION, '0.13.0')) {
  // skip tests
} else {
  // run tests
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice suggestion.

However, I am not able to use semver to compare the versions. I am getting the following error if I use semver in tests:

Service Creation testing encountered a declaration exception
  Message:
    TypeError: Invalid Version: 0.12
  Stack:
    TypeError: Invalid Version: 0.12
        at new SemVer (/Users/pkumar/kong-dashboard/node_modules/semver/semver.js:305:11)
        at compare (/Users/pkumar/kong-dashboard/node_modules/semver/semver.js:578:10)
        at Function.lt (/Users/pkumar/kong-dashboard/node_modules/semver/semver.js:612:10)
        at Suite.fdescribe (/Users/pkumar/kong-dashboard/tests/cases/services/create-service.spec.js:16:16)
        at Object.<anonymous> (/Users/pkumar/kong-dashboard/tests/cases/services/create-service.spec.js:14:1)
        at Module._compile (internal/modules/cjs/loader.js:702:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)

I need to spend more time figuring this issue out. Looks like by node (v10.2.1) and npm (5.6.0) versions are not liking Semver. Let me know if this is a blocker for merging this pull request. I will be working on route integration next and will revisit this issue once I write tests for routes.

Copy link
Owner

Choose a reason for hiding this comment

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

Ok no worry I'll take care of that.

@peeyush1234
Copy link
Contributor Author

peeyush1234 commented May 28, 2018

Looks like about half of the builds are failing due to the following error:

[16:12:46] I/launcher - Running 1 instances of WebDriver
[16:12:46] I/direct - Using ChromeDriver directly...
[16:12:46] E/direct - Error code: 135
[16:12:46] E/direct - Error message: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
[16:12:46] E/direct - Error: Could not find update-config.json. Run 'webdriver-manager update' to download binaries.
    at Direct.getNewDriver (/home/travis/build/PGBI/kong-dashboard/node_modules/protractor/built/driverProviders/direct.js:63:31)
    at Runner.createBrowser (/home/travis/build/PGBI/kong-dashboard/node_modules/protractor/built/runner.js:195:43)
    at q.then.then (/home/travis/build/PGBI/kong-dashboard/node_modules/protractor/built/runner.js:339:29)
    at _fulfilled (/home/travis/build/PGBI/kong-dashboard/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/home/travis/build/PGBI/kong-dashboard/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/home/travis/build/PGBI/kong-dashboard/node_modules/q/q.js:796:13)
    at /home/travis/build/PGBI/kong-dashboard/node_modules/q/q.js:556:49
    at runSingle (/home/travis/build/PGBI/kong-dashboard/node_modules/q/q.js:137:13)
    at flush (/home/travis/build/PGBI/kong-dashboard/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
[16:12:46] E/launcher - Process exited with error code 135

I think this is an intermittent issue as few builds succeeded and my code change is not at all significant. @PGBI Since I don't have necessary permissions, would you mind restarting the builds and see if this issue persist?

@PGBI
Copy link
Owner

PGBI commented May 29, 2018

yep, seems like Travis had a temporary issue. I restarted the tests, we'll see how it goes. Next time, you can also restart the tests by just pushing an empty commit.

@peeyush1234
Copy link
Contributor Author

@PGBI Thanks for restarting the tests. All the tests passed this time.

Next time I will push an empty commit if needed.

@PGBI PGBI merged commit 113b38b into PGBI:3.4.0 May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants