github.com/verrazzano/verrazzano@v1.7.1/pkg/vzchecks/requirement_test.go (about)

     1  // Copyright (c) 2022, Oracle and/or its affiliates.
     2  // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     3  
     4  package vzchecks
     5  
     6  import (
     7  	"github.com/stretchr/testify/assert"
     8  	"testing"
     9  )
    10  
    11  // TestGetVZRequirement tests getting Verrazzano requirement for various profiles
    12  func TestGetVZRequirement(t *testing.T) {
    13  	var tests = []struct {
    14  		profile   ProfileType
    15  		nodeCount int
    16  		cpu       string
    17  		memory    string
    18  		storage   string
    19  	}{
    20  		{Dev, 1, "2", "16G", "100G"},
    21  		{Prod, 3, "4", "32G", "100G"},
    22  		{ManagedCluster, 1, "4", "32G", "100G"},
    23  		{"", 3, "4", "32G", "100G"},
    24  	}
    25  
    26  	for _, tt := range tests {
    27  		t.Run(string(tt.profile), func(t *testing.T) {
    28  			vzReq := getVZRequirement(tt.profile)
    29  			assert.Equal(t, tt.nodeCount, vzReq.nodeCount)
    30  			assert.Equal(t, tt.cpu, vzReq.cpu.allocatable.String())
    31  			assert.Equal(t, tt.memory, vzReq.memory.allocatable.String())
    32  			assert.Equal(t, tt.storage, vzReq.ephemeralStorage.allocatable.String())
    33  		})
    34  	}
    35  }
    36  
    37  // TestUnspecifiedProfileRequirement tests getting Verrazzano requirement for unspecified profile
    38  func TestUnspecifiedProfileRequirement(t *testing.T) {
    39  	vzReq := getVZRequirement("unspecified")
    40  	assert.Equal(t, vzReq, VZRequirement{})
    41  }