-
Notifications
You must be signed in to change notification settings - Fork 0
Gitlab prov metadata #31
base: master
Are you sure you want to change the base?
Conversation
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.
In addition to comments:
- Please add the new step to
manifest.ttl
- I recommend the use of
@tpluscode/rdf-ns-builders
overall when working with common vocabs in code
it('provFromGitlab produces a provenance template', async () => { | ||
setMockEnvironment() | ||
const pointer = provFromGitlab() | ||
strictEqual(pointer.dataset.toString(), snapshot) |
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 would propose to use chai
and something like chai-snapshot-matcher
And also canonical representation for consistent comparison
strictEqual(pointer.dataset.toString(), snapshot) | |
expect(pointer.dataset.toCanonica()).to.matchSnapshot(this) |
test/metadata/produceProv.test.js
Outdated
it('should be a function', () => { | ||
strictEqual(typeof provFromGitlab, 'function') | ||
}) |
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.
TBH, I never understood the utility of those test cases
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 guess it's to ensure the 'intended type' in a test.
For example, in our code-bases to ensure that a factory is actually a factory, or in other cases that a promise is a promise.
It helps when you don't have types, and you want to protect yourself from shooting in the foot.
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.
Any other test will fail when you try to call this so I find "testing language feature" like that a little pointless
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'm just guessing :)
Do you think these need to be removed from barnard-rdf tests ?
lib/namespaces.js
Outdated
|
||
export { cube, rdf, rdfs, sh, xsd, _void, dcat, schema, dcterms } | ||
export { cube, rdf, rdfs, sh, xsd, _void, dcat, schema, dcterms, prov } |
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.
export { cube, rdf, rdfs, sh, xsd, _void, dcat, schema, dcterms, prov } | |
export { cube, rdf, rdfs, sh, xsd, _void, dcat, schema, dcterms } | |
export { prov } from '@tpluscode/rdf-ns-builders' |
Might consider for other vocabs too. These will also give you IDE suggestions
test/appendGitlabProv.test.js
Outdated
it('should throw an error if no argument is given', async () => { | ||
await assertThrows(async () => { | ||
await appendGitlabProv() | ||
}, Error, /Needs subjectsWithClass as parameter/) | ||
}) |
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.
On second thought, I think I would not throw but log a warning and continue as pass-through. Not sure though
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 think it needs to stop, so the developer can fix the pipeline.
What I'm not sure about is if warnings should be shown if the pipeline is run outside GitLab.
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.
See the other comment where I propose to put this whole thing around.
Metadata is dependent on the environment. You would not have a warning that "it's not GitLab" but rather an info that "GitLab has been detected". And later have the option for other providers, also custom
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.
Makes sense. 'Gitlab detected' is ok, but this pull request only knows about Gitlab
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 changed the step to 'detect' environments instead of a warning.
It will log when Gitlab variables are detected.
|
Codecov Report
@@ Coverage Diff @@
## master zazuko/barnard59-rdf#31 +/- ##
==========================================
+ Coverage 97.00% 97.26% +0.26%
==========================================
Files 19 21 +2
Lines 1168 1355 +187
==========================================
+ Hits 1133 1318 +185
- Misses 35 37 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This pull request is a Gitlab specific step that attaches provenance metadata to subjects of Type Dataset,
It looks like this:
It will produce the following data:
It's mainly a draft because the model is not yet stable. (I need your help to make it stable)