Skip to content

Commit a43532c

Browse files
committed
events: document and test artifact events
- docs/source/markdown/podman-events.1.md: Documented the `artifact` event type, its associated statuses (`create`, `pull`, `push`, `remove`), the `artifact=` filter, and updated the Journald Identifiers table. - test/e2e/events_test.go: Added an end-to-end test to verify that `podman artifact` operations properly emit the expected events in chronological order. Signed-off-by: Byounguk Lee <nimdrak@gmail.com>
1 parent 2cfc2c7 commit a43532c

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

docs/source/markdown/podman-events.1.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ The *image* event type reports the following statuses:
7070
* unmount
7171
* untag
7272

73+
The *artifact* event type reports the following statuses:
74+
* create
75+
* pull
76+
* push
77+
* remove
78+
7379
The *system* type reports the following statuses:
7480
* refresh
7581
* renumber
@@ -102,6 +108,7 @@ filters are supported:
102108

103109
| **Filter** | **Description** |
104110
|------------|-------------------------------------|
111+
| artifact | [Name or ID] Artifact name or ID |
105112
| container | [Name or ID] Container's name or ID |
106113
| event | event_status (described above) |
107114
| image | [Name or ID] Image name or ID |
@@ -167,8 +174,8 @@ The journald events-backend of Podman uses the following journald identifiers.
167174
| PODMAN_EVENT | The event status as described above |
168175
| PODMAN_TYPE | The event type as described above |
169176
| PODMAN_TIME | The time stamp when the event was written |
170-
| PODMAN_NAME | Name of the event object (e.g., container, image) |
171-
| PODMAN_ID | ID of the event object (e.g., container, image) |
177+
| PODMAN_NAME | Name of the event object (e.g., container, image, artifact) |
178+
| PODMAN_ID | ID of the event object (e.g., container, image, artifact) |
172179
| PODMAN_EXIT_CODE | Exit code of the container |
173180
| PODMAN_POD_ID | Pod ID of the container |
174181
| PODMAN_LABELS | Labels of the container |

test/e2e/events_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,42 @@ var _ = Describe("Podman events", func() {
307307
Expect(result).Should(ExitCleanly())
308308
Expect(result.OutputToStringArray()).ToNot(BeEmpty(), "Number of health_status events")
309309
})
310+
311+
It("podman events for artifacts", func() {
312+
artifactFile, err := createArtifactFile(1024)
313+
Expect(err).ToNot(HaveOccurred())
314+
315+
lock, port, err := setupRegistry(nil)
316+
if err == nil {
317+
defer lock.Unlock()
318+
}
319+
Expect(err).ToNot(HaveOccurred())
320+
321+
artifactName := fmt.Sprintf("localhost:%s/test/events-artifact-remote:latest", port)
322+
add := podmanTest.Podman([]string{"artifact", "add", artifactName, artifactFile})
323+
add.WaitWithDefaultTimeout()
324+
Expect(add).Should(ExitCleanly())
325+
326+
push := podmanTest.Podman([]string{"artifact", "push", "-q", "--tls-verify=false", artifactName})
327+
push.WaitWithDefaultTimeout()
328+
Expect(push).Should(ExitCleanly())
329+
330+
rm := podmanTest.Podman([]string{"artifact", "rm", artifactName})
331+
rm.WaitWithDefaultTimeout()
332+
Expect(rm).Should(ExitCleanly())
333+
334+
pull := podmanTest.Podman([]string{"artifact", "pull", "-q", "--tls-verify=false", artifactName})
335+
pull.WaitWithDefaultTimeout()
336+
Expect(pull).Should(ExitCleanly())
337+
338+
result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=artifact", "--filter", "artifact=" + artifactName})
339+
result.WaitWithDefaultTimeout()
340+
Expect(result).Should(ExitCleanly())
341+
events := result.OutputToStringArray()
342+
Expect(events).To(HaveLen(4), "number of artifact events")
343+
Expect(events[0]).To(And(ContainSubstring("artifact create"), ContainSubstring(artifactName)), "event log includes artifact create")
344+
Expect(events[1]).To(And(ContainSubstring("artifact push"), ContainSubstring(artifactName)), "event log includes artifact push")
345+
Expect(events[2]).To(And(ContainSubstring("artifact remove"), ContainSubstring(artifactName)), "event log includes artifact remove")
346+
Expect(events[3]).To(And(ContainSubstring("artifact pull"), ContainSubstring(artifactName)), "event log includes artifact pull")
347+
})
310348
})

0 commit comments

Comments
 (0)