-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Adds cache option to uplinks #132
Conversation
lib/storage.js
Outdated
@@ -246,7 +246,11 @@ Storage.prototype.get_tarball = function(name, filename) { | |||
}, self.config) | |||
} | |||
|
|||
var savestream = self.local.add_tarball(name, filename) | |||
var savestream | |||
var docache = !!uplink.cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: Any reason to have a double negation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are correct, this is rather unneccessary. Out of habit, I think...
I'm considering to merge this one, but I'd need a rebase from master and unit testing. Could you take a look #142 @silkentrance ? |
@juanpicado Will do as soon as I find the time. Is tomorrow ok with you? |
@silkentrance sure, no problem, take your time 👍 |
2ec20fa
to
62bd467
Compare
I also fixed the existing integration tests, namely I adjusted the sinopia-test-1.2.3.tgz package to match the requirements, renaming everything to verdaccio. I also added test/integration/config_nocache.yaml and test/integration/test_nocache.pl. I think that these integration tests need to be re-implemented 😁 The configuration uplink caching behavior is tested in test/unit/config.js. |
Codecov Report
@@ Coverage Diff @@
## master #132 +/- ##
==========================================
+ Coverage 79.12% 79.18% +0.05%
==========================================
Files 24 24
Lines 2247 2253 +6
==========================================
+ Hits 1778 1784 +6
Misses 469 469
Continue to review full report at Codecov.
|
Awesome, I'll review it soon 👍 |
ATM I am working on implementing the functional tests, but this may take a while. I need to get my head around the test cases first. |
@juanpicado I am having a hard time with the proper configuration of server3 (config-3.yaml) in test/functional. It will always fail with a 404 on get_package. While the integration test works as expected, I cannot get it to work in the functional tests. Maybe you can give me some hints on how to use the functional server test API? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll need your feedback about the perl file, I have no clue :) the "why".
lib/storage.js
Outdated
_autogenerated: true, | ||
}, self.config); | ||
} | ||
let savestream = self.local.add_tarball(name, filename); | ||
let savestream = null; | ||
if (uplink.config.cache == true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need ==
for true?
test/functional/gh131.js
Outdated
const PKG_NOCACHE = 'pkg_nocache'; | ||
const PKG_NOCACHE2 = 'pkg_nocache2'; | ||
|
||
function iscached(pkgname, tarballname) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCase here please, isCache
. The same in other functions. I'll enable camelCase eslint rule soon.
test/functional/gh131.js
Outdated
}); | ||
|
||
before(function() { | ||
let pkg = require('./lib/package')(PKG_NOCACHE2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const if the variable does not change
test/functional/lib/startup.js
Outdated
@@ -41,4 +42,5 @@ module.exports.start = function(dir, conf) { | |||
process.on('exit', function() { | |||
if (forks[0]) forks[0].kill(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use curly
braces, I'll enable that rule soon as well.
test/unit/config.js
Outdated
@@ -0,0 +1,17 @@ | |||
'use strict'; | |||
|
|||
let assert = require('assert'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
for imports
test/unit/partials/config.js
Outdated
@@ -2,6 +2,11 @@ | |||
|
|||
let config = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
here as well
@silkentrance I'm testing your branch locally, to figure out the |
@juanpicado will fix. thanks for looking into this. 👍 |
@silkentrance the const PKG_NOCACHE = 'pkg_nocache';
const PKG_NOCACHE2 = 'pkg_nocache2'; Thus, the uplinks are false, that drives you to 404. Then if you fix that the asserts are false, I do not know if the |
@juanpicado Thanks so much for Findling |
@juanpicado Thank you so much for finding this annoying typo. I will fix that right away incl. the issues you found in your review. |
Dunno why this was closed. Must have hit the wrong button... |
@juanpicado fixed issues and tests. rebased to master. |
Cool !! @silkentrance I'll review it asap |
Awesome work, unit testing widely complete 👍 thanks so much ! This goes to the next version. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Open to discussion. Please review.
WIP: needs tests
[GH-131] add cache option to uplinks