go-sqlmock icon indicating copy to clipboard operation
go-sqlmock copied to clipboard

Wrong condition to check Begin options

Open kpeu3i opened this issue 1 year ago • 1 comments
trafficstars

There is a bug on this line https://github.com/DATA-DOG/go-sqlmock/blob/master/sqlmock.go#L256

	if expected.txOpts != nil &&
		expected.txOpts.Isolation != opts.Isolation &&
		expected.txOpts.ReadOnly != opts.ReadOnly {
		return nil, fmt.Errorf("expected transaction options do not match: %+v, got: %+v", expected.txOpts, opts)
	}

but should be:

	if expected.txOpts != nil &&
		(expected.txOpts.Isolation != opts.Isolation || expected.txOpts.ReadOnly != opts.ReadOnly) {
		return nil, fmt.Errorf("expected transaction options do not match: %+v, got: %+v", expected.txOpts, opts)
	}

kpeu3i avatar Sep 12 '24 12:09 kpeu3i

@ninadingole please check

kpeu3i avatar Sep 17 '24 13:09 kpeu3i