@@ -34,7 +34,7 @@ import (
3434func TestNewCollector (t * testing.T ) {
3535 cmd := & cobra.Command {Use : "test" }
3636 // Passing nil for args prevents getBlueprint from attempting to read a file
37- c := NewCollector (cmd , nil )
37+ c := NewCollector (cmd , nil , SOURCE )
3838
3939 if c == nil {
4040 t .Fatal ("Expected NewCollector to return a valid Collector, got nil" )
@@ -61,20 +61,23 @@ func TestCollectMetrics_Extensible(t *testing.T) {
6161 OS_VERSION ,
6262 TERRAFORM_VERSION ,
6363 BILLING_ACCOUNT_ID ,
64+ INSTALLATION_MODE ,
6465 IS_TEST_DATA ,
6566 EXIT_CODE ,
6667 }
6768
6869 tests := []struct {
69- name string
70- errorCode int
71- setupCmd func (cmd * cobra.Command ) // Hook to configure the command
72- setupCollector func (c * Collector ) // Hook to mock internal collector state
73- expectedValues map [string ]string
70+ name string
71+ errorCode int
72+ installationMode string
73+ setupCmd func (cmd * cobra.Command ) // Hook to configure the command
74+ setupCollector func (c * Collector ) // Hook to mock internal collector state
75+ expectedValues map [string ]string
7476 }{
7577 {
76- name : "Success exit code" ,
77- errorCode : 0 ,
78+ name : "Success exit code" ,
79+ errorCode : 0 ,
80+ installationMode : SOURCE ,
7881 setupCmd : func (cmd * cobra.Command ) {
7982 // Define dummy flags for the mock command
8083 cmd .Flags ().Bool ("force" , false , "Force execution" )
@@ -119,11 +122,13 @@ func TestCollectMetrics_Extensible(t *testing.T) {
119122 OS_VERSION : getOSVersion (), // Dynamically expect the current OS version
120123 TERRAFORM_VERSION : getTerraformVersion (), // Dynamically expect the current Terraform version
121124 BILLING_ACCOUNT_ID : "" ,
125+ INSTALLATION_MODE : SOURCE ,
122126 },
123127 },
124128 {
125- name : "Failure exit code with missing region, zone, and machine type" ,
126- errorCode : 1 ,
129+ name : "Failure exit code with missing region, zone, and machine type" ,
130+ errorCode : 1 ,
131+ installationMode : BINARY ,
127132 setupCmd : func (cmd * cobra.Command ) {
128133 // No flags set
129134 },
@@ -145,6 +150,7 @@ func TestCollectMetrics_Extensible(t *testing.T) {
145150 TERRAFORM_VERSION : getTerraformVersion (), // Verify Terraform version is still collected on failure
146151 MACHINE_TYPE : "" , // Verify empty machine type when no matching modules exist
147152 BILLING_ACCOUNT_ID : "" ,
153+ INSTALLATION_MODE : BINARY ,
148154 },
149155 },
150156 }
@@ -159,7 +165,7 @@ func TestCollectMetrics_Extensible(t *testing.T) {
159165 }
160166
161167 // Initialize the collector
162- c := NewCollector (cmd , []string {})
168+ c := NewCollector (cmd , []string {}, tt . installationMode )
163169
164170 // Execute the setup function to apply the blueprint state to the collector
165171 if tt .setupCollector != nil {
@@ -191,7 +197,7 @@ func TestBuildConcordEvent(t *testing.T) {
191197 childCmd := & cobra.Command {Use : "deploy" }
192198 rootCmd .AddCommand (childCmd )
193199
194- c := NewCollector (childCmd , nil )
200+ c := NewCollector (childCmd , nil , SOURCE )
195201 c .CollectMetrics (0 )
196202
197203 event := c .BuildConcordEvent ()
0 commit comments