diff --git a/test/integration/test-cases/include-needs-transitive.sh b/test/integration/test-cases/include-needs-transitive.sh index 318d74ae..ee8e10d2 100644 --- a/test/integration/test-cases/include-needs-transitive.sh +++ b/test/integration/test-cases/include-needs-transitive.sh @@ -13,59 +13,59 @@ test_start "include-needs vs include-transitive-needs" # Test 1: --include-needs should include only direct dependencies info "Testing --include-needs includes only direct dependencies" -${helmfile} -f ${include_needs_case_input_dir}/helmfile.yaml -l name=serviceA template --include-needs > ${include_needs_tmp}/include-needs.log 2>&1 || fail "helmfile template --include-needs should not fail" +${helmfile} -f ${include_needs_case_input_dir}/helmfile.yaml -l name=service-a template --include-needs > ${include_needs_tmp}/include-needs.log 2>&1 || fail "helmfile template --include-needs should not fail" -# Verify that serviceA, serviceB are included in the output (serviceB is direct need of serviceA) -# serviceC should NOT be included (it's transitive, not direct) +# Verify that service-a, service-b are included in the output (service-b is direct need of service-a) +# service-c should NOT be included (it's transitive, not direct) include_needs_output=$(cat ${include_needs_tmp}/include-needs.log) -if echo "${include_needs_output}" | grep -q "name: serviceA" && \ - echo "${include_needs_output}" | grep -q "name: serviceB" && \ - ! echo "${include_needs_output}" | grep -q "name: serviceC"; then - info "--include-needs correctly includes only direct dependencies (serviceA, serviceB)" +if echo "${include_needs_output}" | grep -q "name: service-a" && \ + echo "${include_needs_output}" | grep -q "name: service-b" && \ + ! echo "${include_needs_output}" | grep -q "name: service-c"; then + info "--include-needs correctly includes only direct dependencies (service-a, service-b)" else cat ${include_needs_tmp}/include-needs.log - fail "--include-needs should include only serviceA and serviceB (direct need), not serviceC (transitive)" + fail "--include-needs should include only service-a and service-b (direct need), not service-c (transitive)" fi -# Verify log shows "1 release(s) matching name=serviceA" (not 2 or 3) -if echo "${include_needs_output}" | grep -q "1 release(s) matching name=serviceA"; then +# Verify log shows "1 release(s) matching name=service-a" (not 2 or 3) +if echo "${include_needs_output}" | grep -q "1 release(s) matching name=service-a"; then info "Log correctly shows 1 release matching selector" else cat ${include_needs_tmp}/include-needs.log - fail "Log should show '1 release(s) matching name=serviceA', not including needs count" + fail "Log should show '1 release(s) matching name=service-a', not including needs count" fi # Test 2: --include-transitive-needs should include all transitive dependencies info "Testing --include-transitive-needs includes all transitive dependencies" -${helmfile} -f ${include_needs_case_input_dir}/helmfile.yaml -l name=serviceA template --include-transitive-needs > ${include_needs_tmp}/include-transitive-needs.log 2>&1 || fail "helmfile template --include-transitive-needs should not fail" +${helmfile} -f ${include_needs_case_input_dir}/helmfile.yaml -l name=service-a template --include-transitive-needs > ${include_needs_tmp}/include-transitive-needs.log 2>&1 || fail "helmfile template --include-transitive-needs should not fail" -# Verify that serviceA, serviceB, serviceC are all included +# Verify that service-a, service-b, service-c are all included transitive_output=$(cat ${include_needs_tmp}/include-transitive-needs.log) -if echo "${transitive_output}" | grep -q "name: serviceA" && \ - echo "${transitive_output}" | grep -q "name: serviceB" && \ - echo "${transitive_output}" | grep -q "name: serviceC"; then - info "--include-transitive-needs correctly includes all transitive dependencies (serviceA, serviceB, serviceC)" +if echo "${transitive_output}" | grep -q "name: service-a" && \ + echo "${transitive_output}" | grep -q "name: service-b" && \ + echo "${transitive_output}" | grep -q "name: service-c"; then + info "--include-transitive-needs correctly includes all transitive dependencies (service-a, service-b, service-c)" else cat ${include_needs_tmp}/include-transitive-needs.log - fail "--include-transitive-needs should include serviceA, serviceB, and serviceC (transitive)" + fail "--include-transitive-needs should include service-a, service-b, and service-c (transitive)" fi -# Verify log still shows "1 release(s) matching name=serviceA" (selector match, not total) -if echo "${transitive_output}" | grep -q "1 release(s) matching name=serviceA"; then +# Verify log still shows "1 release(s) matching name=service-a" (selector match, not total) +if echo "${transitive_output}" | grep -q "1 release(s) matching name=service-a"; then info "Log correctly shows 1 release matching selector (not including transitive needs)" else cat ${include_needs_tmp}/include-transitive-needs.log - fail "Log should show '1 release(s) matching name=serviceA', not including needs count" + fail "Log should show '1 release(s) matching name=service-a', not including needs count" fi -# Test 3: Verify serviceD is never included (not in dependency chain) -if ! echo "${include_needs_output}" | grep -q "name: serviceD" && \ - ! echo "${transitive_output}" | grep -q "name: serviceD"; then - info "serviceD correctly not included (not in dependency chain)" +# Test 3: Verify service-d is never included (not in dependency chain) +if ! echo "${include_needs_output}" | grep -q "name: service-d" && \ + ! echo "${transitive_output}" | grep -q "name: service-d"; then + info "service-d correctly not included (not in dependency chain)" else - fail "serviceD should never be included as it's not in the dependency chain" + fail "service-d should never be included as it's not in the dependency chain" fi # Cleanup diff --git a/test/integration/test-cases/include-needs-transitive/input/helmfile.yaml b/test/integration/test-cases/include-needs-transitive/input/helmfile.yaml index 6d6c97b7..0a432fb1 100644 --- a/test/integration/test-cases/include-needs-transitive/input/helmfile.yaml +++ b/test/integration/test-cases/include-needs-transitive/input/helmfile.yaml @@ -1,6 +1,7 @@ releases: - - name: serviceA + - name: service-a chart: ../../../charts/raw + namespace: helmfile-tests values: - templates: - | @@ -12,10 +13,11 @@ releases: data: name: {{ .Release.Name }} needs: - - serviceB + - service-b - - name: serviceB + - name: service-b chart: ../../../charts/raw + namespace: helmfile-tests values: - templates: - | @@ -27,10 +29,11 @@ releases: data: name: {{ .Release.Name }} needs: - - serviceC + - service-c - - name: serviceC + - name: service-c chart: ../../../charts/raw + namespace: helmfile-tests values: - templates: - | @@ -42,8 +45,9 @@ releases: data: name: {{ .Release.Name }} - - name: serviceD + - name: service-d chart: ../../../charts/raw + namespace: helmfile-tests values: - templates: - |