Add tests for hugepages resource requests/limits
This commit is contained in:
		
							parent
							
								
									a5387a1e66
								
							
						
					
					
						commit
						96c784ec79
					
				|  | @ -5,9 +5,8 @@ import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"sort" | 	"sort" | ||||||
| 	"time" |  | ||||||
| 
 |  | ||||||
| 	"testing" | 	"testing" | ||||||
|  | 	"time" | ||||||
| 
 | 
 | ||||||
| 	"github.com/stretchr/testify/assert" | 	"github.com/stretchr/testify/assert" | ||||||
| 
 | 
 | ||||||
|  | @ -2979,6 +2978,49 @@ func TestGenerateResourceRequirements(t *testing.T) { | ||||||
| 				ResourceLimits:   acidv1.ResourceDescription{CPU: "1", Memory: "2Gi"}, | 				ResourceLimits:   acidv1.ResourceDescription{CPU: "1", Memory: "2Gi"}, | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
|  | 		{ | ||||||
|  | 			subTest: "test HugePages are passed through to the postgres container", | ||||||
|  | 			config: config.Config{ | ||||||
|  | 				Resources:           configResources, | ||||||
|  | 				PodManagementPolicy: "ordered_ready", | ||||||
|  | 			}, | ||||||
|  | 			pgSpec: acidv1.Postgresql{ | ||||||
|  | 				ObjectMeta: metav1.ObjectMeta{ | ||||||
|  | 					Name:      clusterName, | ||||||
|  | 					Namespace: namespace, | ||||||
|  | 				}, | ||||||
|  | 				Spec: acidv1.PostgresSpec{ | ||||||
|  | 					Resources: &acidv1.Resources{ | ||||||
|  | 						ResourceRequests: acidv1.ResourceDescription{ | ||||||
|  | 							HugePages2Mi: "128Mi", | ||||||
|  | 							HugePages1Gi: "1Gi", | ||||||
|  | 						}, | ||||||
|  | 						ResourceLimits: acidv1.ResourceDescription{ | ||||||
|  | 							HugePages2Mi: "256Mi", | ||||||
|  | 							HugePages1Gi: "2Gi", | ||||||
|  | 						}, | ||||||
|  | 					}, | ||||||
|  | 					TeamID: "acid", | ||||||
|  | 					Volume: acidv1.Volume{ | ||||||
|  | 						Size: "1G", | ||||||
|  | 					}, | ||||||
|  | 				}, | ||||||
|  | 			}, | ||||||
|  | 			expectedResources: acidv1.Resources{ | ||||||
|  | 				ResourceRequests: acidv1.ResourceDescription{ | ||||||
|  | 					CPU:          "100m", | ||||||
|  | 					Memory:       "100Mi", | ||||||
|  | 					HugePages2Mi: "128Mi", | ||||||
|  | 					HugePages1Gi: "1Gi", | ||||||
|  | 				}, | ||||||
|  | 				ResourceLimits: acidv1.ResourceDescription{ | ||||||
|  | 					CPU:          "1", | ||||||
|  | 					Memory:       "500Mi", | ||||||
|  | 					HugePages2Mi: "256Mi", | ||||||
|  | 					HugePages1Gi: "2Gi", | ||||||
|  | 				}, | ||||||
|  | 			}, | ||||||
|  | 		}, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	for _, tt := range tests { | 	for _, tt := range tests { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue