Skip to content

Conversation

@paikend
Copy link
Collaborator

@paikend paikend commented Oct 8, 2025

Overview

Improve test code quality by removing unnecessary defensive checks and adding explicit validations discovered during #77 investigation.

Key Changes

  • Remove unnecessary or [] fallback in fixed_ips assertions
    • res.fixed_ips or []res.fixed_ips (fixed_ips is never None in test contexts)
    • Applied to test_add_port_fixed_ip and test_remove_port_fixed_ip
  • Add explicit validation for bulk operation results
    • Add actual value validation to tests that only checked length
    • Added assert bulk[0].id == f1.id in test_update_reassign_bulk_and_auto_assign_floating_ip

Related Issues

Additional context

While investigating #77 for potential call_count test issues, no problems were found with that specific case. However, these code quality improvements were identified and addressed:

  • The or [] pattern was redundant since fixed_ips is always a list in these test scenarios
  • The bulk operation test only checked length (len(bulk) == 1) without validating the actual returned object's ID, so added explicit value validation

Overview

#77 조사 중 발견된 불필요한 방어 코드를 제거하고 명시적인 검증을 추가하여 테스트 코드 품질을 개선합니다.

Key Changes

  • fixed_ips assertion에서 불필요한 or [] 폴백 제거
    • res.fixed_ips or []res.fixed_ips (테스트 컨텍스트에서 fixed_ips는 절대 None이 아님)
    • test_add_port_fixed_iptest_remove_port_fixed_ip에 적용
  • bulk 작업 결과에 대한 명시적 검증 추가
    • 길이 검사만 하던 테스트에 실제 값 검증 추가
    • test_update_reassign_bulk_and_auto_assign_floating_ipassert bulk[0].id == f1.id 추가

Related Issues

Additional context

#77의 call_count 테스트 문제를 조사하는 과정에서 해당 케이스의 문제는 발견되지 않았으나, 다음과 같은 코드 품질 개선 사항을 발견하여 수정했습니다:

  • or [] 패턴은 테스트 시나리오에서 fixed_ips가 항상 리스트이므로 불필요함
  • bulk 작업 테스트에서 길이 검사(len(bulk) == 1)만 하고 있어, 반환된 객체의 실제 값(ID)에 대한 검증을 추가함

- Remove defensive 'or []' checks when fixed_ips is never None
- Add explicit validation for bulk operation results
- Related to #77 investigation (no call_count issues found)
Copy link
Collaborator

@choieastsea choieastsea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@jja6312 jja6312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM👍

@paikend paikend merged commit 9469ffc into develop Oct 13, 2025
6 checks passed
halucinor pushed a commit that referenced this pull request Oct 23, 2025
- Remove defensive 'or []' checks when fixed_ips is never None
- Add explicit validation for bulk operation results
- Related to #77 investigation (no call_count issues found)
halucinor pushed a commit that referenced this pull request Oct 24, 2025
- Remove defensive 'or []' checks when fixed_ips is never None
- Add explicit validation for bulk operation results
- Related to #77 investigation (no call_count issues found)
@halucinor halucinor deleted the feat/remove-counting-tc branch October 30, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants