Skip to content

Commit

Permalink
Fix test cases.
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Fiehe <[email protected]>
  • Loading branch information
Christoph Fiehe committed Oct 11, 2024
1 parent f8ea477 commit 61e9f5a
Show file tree
Hide file tree
Showing 23 changed files with 295 additions and 167 deletions.
7 changes: 5 additions & 2 deletions cmd/publish_source_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,19 @@ func aptlyPublishSourceAdd(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to save to DB: %s", err)
}

context.Progress().Printf("\nYou can run 'aptly publish update %s %s' to update the content of the published repository.\n",
distribution, published.StoragePrefix())

return err
}

func makeCmdPublishSourceAdd() *commander.Command {
cmd := &commander.Command{
Run: aptlyPublishSourceAdd,
UsageLine: "add <distribution> <source>",
Short: "add package source to published repository",
Short: "add source to staged source list of published repository",
Long: `
The command adds (in place) one or multiple package sources to a published repository.
The command adds sources to the staged source list of the published repository.
The flag -component is mandatory. Use a comma-separated list of components, if
multiple components should be modified. The number of given components must be
Expand Down
6 changes: 3 additions & 3 deletions cmd/publish_source_drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ func makeCmdPublishSourceDrop() *commander.Command {
cmd := &commander.Command{
Run: aptlyPublishSourceDrop,
UsageLine: "drop <distribution>",
Short: "drops revision of published repository",
Short: "drops staged source changes of published repository",
Long: `
Command drops revision of a published repository.
Command drops the staged source changes of the published repository.
Example:
$ aptly publish revision drop wheezy
$ aptly publish source drop wheezy
`,
Flag: *flag.NewFlagSet("aptly-publish-revision-create", flag.ExitOnError),
}
Expand Down
9 changes: 6 additions & 3 deletions cmd/publish_source_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func aptlyPublishSourceRemove(cmd *commander.Command, args []string) error {
for _, component := range components {
name, exists := sources[component]
if !exists {
return fmt.Errorf("unable to remove: Component %q is not part of revision", component)
return fmt.Errorf("unable to remove: component %q does not exist", component)
}
context.Progress().Printf("Removing component %q with source %q [%s]...\n", component, name, published.SourceKind)

Expand All @@ -54,16 +54,19 @@ func aptlyPublishSourceRemove(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to save to DB: %s", err)
}

context.Progress().Printf("\nYou can run 'aptly publish update %s %s' to update the content of the published repository.\n",
distribution, published.StoragePrefix())

return err
}

func makeCmdPublishSourceRemove() *commander.Command {
cmd := &commander.Command{
Run: aptlyPublishSourceRemove,
UsageLine: "remove <distribution> [[<endpoint>:]<prefix>] <source>",
Short: "remove package source to published repository",
Short: "remove source from staged source list of published repository",
Long: `
The command removes one or multiple components from a published repository.
The command removes sources from the staged source list of the published repository.
The flag -component is mandatory. Use a comma-separated list of components, if
multiple components should be removed, e.g.:
Expand Down
7 changes: 5 additions & 2 deletions cmd/publish_source_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,19 @@ func aptlyPublishSourceUpdate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to save to DB: %s", err)
}

context.Progress().Printf("\nYou can run 'aptly publish update %s %s' to update the content of the published repository.\n",
distribution, published.StoragePrefix())

return err
}

func makeCmdPublishSourceUpdate() *commander.Command {
cmd := &commander.Command{
Run: aptlyPublishSourceUpdate,
UsageLine: "update <distribution> <source>",
Short: "update package source to published repository",
Short: "update source in staged source list of published repository",
Long: `
The command updates one or multiple components in a published repository.
The command updates sources in the staged source list of the published repository.
The flag -component is mandatory. Use a comma-separated list of components, if
multiple components should be modified. The number of given components must be
Expand Down
4 changes: 3 additions & 1 deletion system/t06_publish/PublishSourceAdd1Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Test
Adding component "test" with source "snap2" [snapshot]...

You can run 'aptly publish update maverick .' to update the content of the published repository.
5 changes: 4 additions & 1 deletion system/t06_publish/PublishSourceAdd2Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Test
Adding component "test" with source "snap2" [snapshot]...
Adding component "other-test" with source "snap3" [snapshot]...

You can run 'aptly publish update maverick .' to update the content of the published repository.
2 changes: 1 addition & 1 deletion system/t06_publish/PublishSourceAdd3Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test
ERROR: unable to add: component "main" has already been added
2 changes: 1 addition & 1 deletion system/t06_publish/PublishSourceDrop1Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test
Source changes have been removed successfully.
4 changes: 3 additions & 1 deletion system/t06_publish/PublishSourceList1Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Test
Sources:
main: snap1 [snapshot]
test: snap2 [snapshot]
1 change: 1 addition & 0 deletions system/t06_publish/PublishSourceList2Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ERROR: unable to list: no source changes exist
4 changes: 3 additions & 1 deletion system/t06_publish/PublishSourceRemove1Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Test
Removing component "test" with source "snap2" [snapshot]...

You can run 'aptly publish update maverick .' to update the content of the published repository.
5 changes: 4 additions & 1 deletion system/t06_publish/PublishSourceRemove2Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Test
Removing component "test" with source "snap2" [snapshot]...
Removing component "other-test" with source "snap3" [snapshot]...

You can run 'aptly publish update maverick .' to update the content of the published repository.
2 changes: 1 addition & 1 deletion system/t06_publish/PublishSourceRemove3Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test
ERROR: unable to remove: component "not-existent" does not exist
4 changes: 3 additions & 1 deletion system/t06_publish/PublishSourceUpdate1Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Test
Updating component "main" with source "snap2" [snapshot]...

You can run 'aptly publish update maverick .' to update the content of the published repository.
5 changes: 4 additions & 1 deletion system/t06_publish/PublishSourceUpdate2Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Test
Updating component "main" with source "snap2" [snapshot]...
Updating component "test" with source "snap3" [snapshot]...

You can run 'aptly publish update maverick .' to update the content of the published repository.
2 changes: 1 addition & 1 deletion system/t06_publish/PublishSourceUpdate3Test_gold
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Test
ERROR: unable to update: component "not-existent" does not exist
8 changes: 8 additions & 0 deletions system/t06_publish/PublishUpdate15Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up prefix "." components ...

Published snapshot repository ./maverick (origin: LP-PPA-gladky-anton-gnuplot) [i386] publishes {main: [snap1]: Snapshot from mirror [gnuplot-maverick]: http://ppa.launchpad.net/gladky-anton/gnuplot/ubuntu/ maverick}, {other-test: [snap3]: Created as empty}, {test: [snap2]: Created as empty} has been successfully updated.
1 change: 1 addition & 0 deletions system/t06_publish/PublishUpdate16Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test
1 change: 1 addition & 0 deletions system/t06_publish/PublishUpdate17Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test
1 change: 1 addition & 0 deletions system/t06_publish/PublishUpdate18Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test
2 changes: 1 addition & 1 deletion system/t06_publish/PublishUpdate8Test_gold
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Generating metadata files and linking package files...
Finalizing metadata files...
Cleaning up prefix "." components contrib, main...

Publish for local repo ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated.
Published local repository ./squeeze [i386] publishes {contrib: [repo2]}, {main: [repo1]} has been successfully updated.
Loading

0 comments on commit 61e9f5a

Please sign in to comment.