@@ -8,10 +8,11 @@ import (
88
99func TestReadContainerCheckpointPodOptions (t * testing.T ) {
1010 tests := []struct {
11- name string
12- podOptions CheckpointedPodOptions
13- wantVersion int
14- wantContLen int
11+ name string
12+ podOptions CheckpointedPodOptions
13+ wantVersion int
14+ wantContLen int
15+ wantAnnotations map [string ]string
1516 }{
1617 {
1718 name : "valid pod options" ,
@@ -34,6 +35,27 @@ func TestReadContainerCheckpointPodOptions(t *testing.T) {
3435 wantVersion : 2 ,
3536 wantContLen : 0 ,
3637 },
38+ {
39+ name : "with annotations" ,
40+ podOptions : CheckpointedPodOptions {
41+ Version : 1 ,
42+ Containers : map [string ]string {
43+ "test" : "test-container" ,
44+ },
45+ Annotations : map [string ]string {
46+ CheckpointAnnotationEngine : "podman" ,
47+ CheckpointAnnotationEngineVersion : "4.0.0" ,
48+ CheckpointAnnotationPod : "test-pod" ,
49+ },
50+ },
51+ wantVersion : 1 ,
52+ wantContLen : 1 ,
53+ wantAnnotations : map [string ]string {
54+ CheckpointAnnotationEngine : "podman" ,
55+ CheckpointAnnotationEngineVersion : "4.0.0" ,
56+ CheckpointAnnotationPod : "test-pod" ,
57+ },
58+ },
3759 }
3860
3961 for _ , tt := range tests {
@@ -57,6 +79,17 @@ func TestReadContainerCheckpointPodOptions(t *testing.T) {
5779 if len (podOptions .Containers ) != tt .wantContLen {
5880 t .Errorf ("expected %d containers, got %d" , tt .wantContLen , len (podOptions .Containers ))
5981 }
82+
83+ if tt .wantAnnotations != nil {
84+ if len (podOptions .Annotations ) != len (tt .wantAnnotations ) {
85+ t .Errorf ("expected %d annotations, got %d" , len (tt .wantAnnotations ), len (podOptions .Annotations ))
86+ }
87+ for k , v := range tt .wantAnnotations {
88+ if podOptions .Annotations [k ] != v {
89+ t .Errorf ("expected annotation %s=%s, got %s" , k , v , podOptions .Annotations [k ])
90+ }
91+ }
92+ }
6093 })
6194 }
6295}
0 commit comments