Skip to content

Some tests access undefined proto_var variable #3123

@mattst88

Description

@mattst88

These test scripts all contain a finally: block that attempts to print proto_ver which does not exist:

  • test/broker/02-subpub-qos1-message-expiry.py
  • test/broker/02-subpub-qos1-message-expiry-retain.py
  • test/broker/02-subpub-qos1-message-expiry-will.py
  • test/broker/02-subpub-qos2-pubrec-error.py
print("proto_ver=%d" % (proto_ver))

This mistake appears to be a copy-and-paste error in commit b2a9daf ("02 broker subpub tests with v5 support").

As a fix, I suggest:

  1. s/proto_ver=5/proto_ver=proto_ver/g
  2. s/do_test():/do_test(proto_ver):/g
  3. s/do_test()/do_test(proto_ver=5)/g

I'd submit a patch, but the CLA process is too much for what is a single sed invocation.

sed -i \
	-e 's/proto_ver=5/proto_ver=proto_ver/g' \
	-e 's/do_test():/do_test(proto_ver):/g' \
	-e 's/do_test()/do_test(proto_ver=5)/g' \
	test/broker/02-subpub-qos1-message-expiry.py \
	test/broker/02-subpub-qos1-message-expiry-retain.py \
	test/broker/02-subpub-qos1-message-expiry-will.py \
	test/broker/02-subpub-qos2-pubrec-error.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions