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

Passing opts with upload_config in luatest #1321

Closed
DifferentialOrange opened this issue Mar 17, 2021 · 1 comment · Fixed by #1688
Closed

Passing opts with upload_config in luatest #1321

DifferentialOrange opened this issue Mar 17, 2021 · 1 comment · Fixed by #1688
Assignees
Labels
cartridge feature A new functionality good first issue Good for newcomers teamS Scaling testing Things to be covered with autotests

Comments

@DifferentialOrange
Copy link
Member

DifferentialOrange commented Mar 17, 2021

Cartridge test helper servers have a convenient upload_config option:

--- Upload application config.
-- @tparam string|table config - table will be encoded as yaml and posted to /admin/config.
function Server:upload_config(config)
checks('table', 'string|table')
if type(config) == 'table' then
config = yaml.encode(config)
end
return self:http_request('put', '/admin/config', {body = config})
end

But it's not suited for testing invalid config. Luatest http_request method has options such as { raise = false } to not raise an error on non-200 requests. It would be convenient if I could pass options to http_request call in upload_config method.

@DifferentialOrange DifferentialOrange added the feature A new functionality label Mar 17, 2021
@rosik rosik added the testing Things to be covered with autotests label Mar 17, 2021
@rosik rosik added teamS Scaling 1sp good first issue Good for newcomers cartridge labels Sep 3, 2021
@DifferentialOrange
Copy link
Member Author

Nice one, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cartridge feature A new functionality good first issue Good for newcomers teamS Scaling testing Things to be covered with autotests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants