Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects not supported in @matrix annotation #384

Open
kc596 opened this issue Aug 4, 2023 · 3 comments
Open

Objects not supported in @matrix annotation #384

kc596 opened this issue Aug 4, 2023 · 3 comments

Comments

@kc596
Copy link

kc596 commented Aug 4, 2023

@confluentinc/quality-eng is tagged for visibility

Describe the bug
@matrix annotation is working only if list of primitives are used and not if list of objects are used.

To Reproduce
You can use following example to reproduce :

@dataclass
class Car:
    x: int
    y: int

@dataclass
class Bus:
    x: int
    y: int


# Declare global var of list of objects :
CARS = [Car(1,2)]
BUSES = [Bus(1,2), Bus(2,3)]

# Following annotation works :
@matrix(car_index=[0], bus_index=[0,1])
def test(self, car_index: int, bus_index: int):
    car = CARS[car_index]
    bus = BUSES[bus_index]

# However, this one is not working :
@matrix(car=CARS, bus=BUSES)
def test(self, car: Car, bus: Bus):
    pass

Expected behavior
The tests should work even when list of objects are passed into @matrix.

@imcdo
Copy link
Member

imcdo commented Aug 30, 2023

I Don't agree with this, as arguments should be always json serializable, so they can be passed in via the command line if someone wants to use the exact params.

@stan-is-hate
Copy link
Member

+1 to @imcdo , ducktape needs to keep any paramters json-serializable, otherwise it breaks existing functionality.

@stan-is-hate
Copy link
Member

If your objects are json-serializable though, I think I've seen them work with parameterized tests

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

No branches or pull requests

4 participants
@imcdo @kc596 @stan-is-hate and others