Update create repo API to support snapshots
To achieve feature parity with cli, it is now possible to create repos from snapshots.
- [x] unit-test added (if change is algorithm)
- [ ] functional test added/updated (if change is functional)
- [x] documentation updated
- [x] author name in
AUTHORS
System tests are failing in the part not related to this PR:
Exception: content doesn't match:
---
+++
@@ -1,8 +1,13 @@
Downloading: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/InRelease
-gpgv: Signature made Sun Jul 28 07:57:01 2024 UTC
+Error (retrying): http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/InRelease: Get "http:/gladky-anton/gnuplot/ubuntu/dists/maverick/InRelease": dial tcp 185.125.190.80:80: i/o timeout
+Retrying 0 http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/InRelease...
+Download Error: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/InRelease
+Downloading: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/Release
+Downloading: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/dists/maverick/Release.gpg
+gpgv: Signature made Sun Jul 28 07:57:00 2024 UTC
gpgv: using RSA key 5BFCD481D86D5824470E469F9000B1C3A01F726C
gpgv: Good signature from "Launchpad PPA for Anton Gladky"
-gpgv: Signature made Sun Jul 28 07:57:01 2024 UTC
+gpgv: Signature made Sun Jul 28 07:57:00 2024 UTC
gpgv: using RSA key 02219381E9161C78A46CB2BFA5279A973B1F56C0
gpgv: Good signature from "Launchpad sim"
the ppa test are depending on the Internet, so sometimes this fails. All other tests are based on a mirror, but with ppa this is more difficult to do. I restarted the tests... let's see !
thanks a lot for spotting this !
would you be able to add a system test for this ?
@neolynx I'm not that much into python, unfortunately. It'd be great if someone give a hand in this..
My test passed, though. ))
docs PR: https://github.com/aptly-dev/www.aptly.info/pull/112
@neolynx anything else you want me to change for review to happen?
for the tests, let's see if someone volunteers... it should be quite easy:
make docker-image(if you don't have already)- copy for example the SnapshotsAPITestCreateFromRepo in system/t12_api/snapshots.py to the end and rename
- modify to call apis for creating a repo, adding files, snapshotting it, then creating a new repo from that snapshot (i guess what is the use case?)
- run
make docker-system-test TEST=SnapshotsAPITestRepoFromSnapshot
i can help with the testing once a skeleton is there..
for the documentation, we are migrating to swagger to have it versionned. could you follow the example here https://github.com/aptly-dev/aptly/blob/master/api/mirror.go#L54 to create a documented params struct for b above the function ?
for the tests
I've added a test already last week. Haven't you seen it in the patch set? If you have any comments on the test, let me know.
create a documented params struct for b above the function
Done. Also I've changed http error codes to make errors more semantic.
Also, I had to borrow some code from func (collection *LocalRepoCollection) Add(repo *LocalRepo) to properly check if repo already exists, as Add function returns different string errors and messing with string comparison just to detect particular case is not an option for me. Comments are welcome, though.
Anything else?
I've added a test already last week. Haven't you seen it in the patch set? If you have any comments on the test, let me know.
oops, I missed that, looks great ! I ran a coverage build, and the only lines not covered are error handling, which is ok.
create a documented params struct for b above the function
Done. Also I've changed http error codes to make errors more semantic.
perfect !
I updated the doc slightly and pushed to your branch...
Also, I had to borrow some code from
func (collection *LocalRepoCollection) Add(repo *LocalRepo)to properly check if repo already exists, asAddfunction returns different string errors and messing with string comparison just to detect particular case is not an option for me. Comments are welcome, though.
looks good :)
maybe we could add a test, which provides a non existing snapshot, and fails. this would increase the coverage a bit.. basically your existing test without the first part .. what do you think ?
let me add that :)
this would increase the coverage a bit..
I think, everything is good in moderation. Thriving to reach 100% coverage is a useless effort.
And yet... )
codecov/patch Successful in 1s — 81.48% of diff hit (target 74.87%)
one little test can do a lot :)