Repository navigation
cmd, pkg/podman: Turn Container into an interface and make podman.InspectContainer() return a Container - #1490
Conversation
4cf809d to
3f0270c
Compare
A subsequent commit will switch to unmarshalling the JSON returned from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to limit the details within the podman package and make it easier to write unit tests for it. eg., it requires tracking changes to the JSON output across different Podman versions. Unfortunately, the JSON from 'podman inspect --type container' and 'podman ps --all' are considerably different and it will be awkward to use the same implementation of the json.Unmarshaler interface [1] for both. This difference can be hidden by hiding the concrete types that separately implement json.Unmarshaler behind a Container interface providing access to the values parsed from the JSON. [1] https://pkg.go.dev/encoding/json#Unmarshaler containers#1490
|
✔️ unit-test SUCCESS in 6m 28s |
A subsequent commit will switch to unmarshalling the JSON returned from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to confine the details within the podman package and make it easier to write unit tests for it. eg., it requires tracking changes to the JSON output across different Podman versions. Unfortunately, the JSON from 'podman inspect --type container' and 'podman ps --all' are considerably different and it will be awkward to use the same implementation of the json.Unmarshaler interface [1] for both. This difference can be hidden by hiding the concrete types that separately implement json.Unmarshaler behind a Container interface providing access to the values parsed from the JSON. [1] https://pkg.go.dev/encoding/json#Unmarshaler containers#1490
3f0270c to
12e5ca9
Compare
|
✔️ unit-test SUCCESS in 6m 34s |
Unmarshal the JSON from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to confine the details within the podman package. The JSON samples for the unit tests were taken using the default Toolbx container on versions of Fedora that shipped a specific Podman and Toolbx version. This accounts for differences in the JSON output caused by different major versions of Podman and the way different Toolbx versions set up the containers over time. The minimum required Podman version is 1.6.4 [1], and the Go implementation has been encouraging users to create containers with Toolbx version 0.0.17 or newer [2]. The versions used to collect the JSON samples for the unit tests were chosen accordingly. They don't exhaustively cover all supported version combinations, but hopefully cover enough to be useful. [1] Commit 8e80dd5 containers@8e80dd5db1e6f40b containers#1253 [2] Commit 238f245 containers@238f2451e7d7d54a containers#318 containers#1490
|
✔️ unit-test SUCCESS in 6m 53s |
A subsequent commit will switch to unmarshalling the JSON returned from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to confine the details within the podman package and make it easier to write unit tests for it. eg., it requires tracking changes to the JSON output across different Podman versions. Unfortunately, the JSON from 'podman inspect --type container' and 'podman ps --all' are considerably different and it will be awkward to use the same implementation of the json.Unmarshaler interface [1] for both. One option is to have two different concrete types separately implement json.Unmarshaler to handle the differences in the JSON, and then hiding these concrete types behind a Container interface that provides access to the values parsed from the JSON. [1] https://pkg.go.dev/encoding/json#Unmarshaler containers#1490
Unmarshal the JSON from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to confine the details within the podman package. The JSON samples for the unit tests were taken using the default Toolbx container on versions of Fedora that shipped a specific Podman and Toolbx version. This accounts for differences in the JSON caused by different major versions of Podman and the way different Toolbx versions set up the containers. One exception was Fedora 28, which had Podman 1.1.2 and Toolbx 0.0.9, which is the last Toolbx version before 'toolbox init-container' became the entry point for all Toolbx containers [1]. However, the default Toolbx image is no longer available from registry.fedoraproject.org. Hence, the image for Fedora 29 was used. The minimum required Podman version is 1.6.4 [2], and the Go implementation has been encouraging users to create containers with Toolbx version 0.0.17 or newer [3]. The versions used to collect the JSON samples for the unit tests were chosen accordingly. They don't exhaustively cover all possible supported and unsupported version combinations, but hopefully enough to be useful. [1] Commit 8b84b5e containers@8b84b5e4604921fa https://github.com/debarshiray/toolbox/pull/160 [2] Commit 8e80dd5 containers@8e80dd5db1e6f40b containers#1253 [3] Commit 238f245 containers@238f2451e7d7d54a containers#318 containers#1490
7093f09 to
41dc88c
Compare
|
✔️ unit-test SUCCESS in 6m 54s |
Unmarshal the JSON from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to confine the details within the podman package. The JSON samples for the unit tests were taken using the default Toolbx container on versions of Fedora that shipped a specific Podman and Toolbx version. This accounts for differences in the JSON caused by different major versions of Podman and the way different Toolbx versions set up the containers. One exception was Fedora 28, which had Podman 1.1.2 and Toolbx 0.0.9, which is the last Toolbx version before 'toolbox init-container' became the entry point for all Toolbx containers [1]. However, the default Toolbx image is no longer available from registry.fedoraproject.org. Hence, the image for Fedora 29 was used. The minimum required Podman version is 1.6.4 [2], and the Go implementation has been encouraging users to create containers with Toolbx version 0.0.17 or newer [3]. The versions used to collect the JSON samples for the unit tests were chosen accordingly. They don't exhaustively cover all possible supported and unsupported version combinations, but hopefully enough to be useful. [1] Commit 8b84b5e containers@8b84b5e4604921fa https://github.com/debarshiray/toolbox/pull/160 [2] Commit 8e80dd5 containers@8e80dd5db1e6f40b containers#1253 [3] Commit 238f245 containers@238f2451e7d7d54a containers#318 containers#1490
Unmarshal the JSON from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to confine the details within the podman package. The JSON samples for the unit tests were taken using the default Toolbx container on versions of Fedora that shipped a specific Podman and Toolbx version. This accounts for differences in the JSON caused by different major versions of Podman and the way different Toolbx versions set up the containers. One exception was Fedora 28, which had Podman 1.1.2 and Toolbx 0.0.9, which is the last Toolbx version before 'toolbox init-container' became the entry point for all Toolbx containers [1]. However, the default Toolbx image is no longer available from registry.fedoraproject.org. Hence, the image for Fedora 29 was used. The minimum required Podman version is 1.6.4 [2], and the Go implementation has been encouraging users to create containers with Toolbx version 0.0.17 or newer [3]. The versions used to collect the JSON samples for the unit tests were chosen accordingly. They don't exhaustively cover all possible supported and unsupported version combinations, but hopefully enough to be useful. [1] Commit 8b84b5e containers@8b84b5e4604921fa https://github.com/debarshiray/toolbox/pull/160 [2] Commit 8e80dd5 containers@8e80dd5db1e6f40b containers#1253 [3] Commit 238f245 containers@238f2451e7d7d54a containers#318 containers#1490
41dc88c to
7464c2b
Compare
Let's try to silence this: |
|
✔️ unit-test SUCCESS in 7m 20s |
Unmarshal the JSON from 'podman inspect --format json --type container' directly inside podman.InspectContainer() to confine the details within the podman package. The JSON samples for the unit tests were taken using the default Toolbx container on versions of Fedora that shipped a specific Podman and Toolbx version. This accounts for differences in the JSON caused by different major versions of Podman and the way different Toolbx versions set up the containers. One exception was Fedora 28, which had Podman 1.1.2 and Toolbx 0.0.9, which was the last Toolbx version before 'toolbox init-container' became the entry point for all Toolbx containers [1]. However, the default Toolbx image is no longer available from registry.fedoraproject.org. Hence, the image for Fedora 29 was used. The minimum required Podman version is 1.6.4 [2], and the Go implementation has been encouraging users to create containers with Toolbx version 0.0.17 or newer [3]. The versions used to collect the JSON samples for the unit tests were chosen accordingly. They don't exhaustively cover all possible supported and unsupported version combinations, but hopefully enough to be useful. [1] Commit 8b84b5e containers@8b84b5e4604921fa https://github.com/debarshiray/toolbox/pull/160 [2] Commit 8e80dd5 containers@8e80dd5db1e6f40b containers#1253 [3] Commit 238f245 containers@238f2451e7d7d54a containers#318 containers#1490
7464c2b to
ec7eb59
Compare
|
✔️ unit-test SUCCESS in 7m 02s |
No description provided.