ci: format
This commit is contained in:
parent
fe4c1d0e31
commit
ee75e6844e
2 changed files with 27 additions and 8 deletions
|
|
@ -43,11 +43,22 @@ local function ensure_sync_id(task)
|
|||
bytes[9] = bit.bor(bit.band(bytes[9], 0x3f), 0x80)
|
||||
sync_id = string.format(
|
||||
'%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x',
|
||||
bytes[1], bytes[2], bytes[3], bytes[4],
|
||||
bytes[5], bytes[6],
|
||||
bytes[7], bytes[8],
|
||||
bytes[9], bytes[10],
|
||||
bytes[11], bytes[12], bytes[13], bytes[14], bytes[15], bytes[16]
|
||||
bytes[1],
|
||||
bytes[2],
|
||||
bytes[3],
|
||||
bytes[4],
|
||||
bytes[5],
|
||||
bytes[6],
|
||||
bytes[7],
|
||||
bytes[8],
|
||||
bytes[9],
|
||||
bytes[10],
|
||||
bytes[11],
|
||||
bytes[12],
|
||||
bytes[13],
|
||||
bytes[14],
|
||||
bytes[15],
|
||||
bytes[16]
|
||||
)
|
||||
task._extra['_s3_sync_id'] = sync_id
|
||||
task.modified = os.date('!%Y-%m-%dT%H:%M:%SZ') --[[@as string]]
|
||||
|
|
@ -97,7 +108,9 @@ function M.auth(args)
|
|||
else
|
||||
log.error('s3: SSO login failed — ' .. (login_result.stderr or ''))
|
||||
end
|
||||
elseif stderr:find('Unable to locate credentials') or stderr:find('NoCredentialProviders') then
|
||||
elseif
|
||||
stderr:find('Unable to locate credentials') or stderr:find('NoCredentialProviders')
|
||||
then
|
||||
log.error('s3: no AWS credentials configured. See :h pending-s3')
|
||||
else
|
||||
log.error('s3: ' .. stderr)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,9 @@ describe('s3', function()
|
|||
local task = { _extra = nil, modified = '2026-01-01T00:00:00Z' }
|
||||
local id = s3._ensure_sync_id(task)
|
||||
assert.is_not_nil(id)
|
||||
assert.truthy(id:match('^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$'))
|
||||
assert.truthy(
|
||||
id:match('^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$')
|
||||
)
|
||||
assert.equals(id, task._extra['_s3_sync_id'])
|
||||
end)
|
||||
|
||||
|
|
@ -79,7 +81,11 @@ describe('s3', function()
|
|||
it('reports success on valid credentials', function()
|
||||
util.system = function(args)
|
||||
if vim.tbl_contains(args, 'get-caller-identity') then
|
||||
return { code = 0, stdout = '{"Account":"123456","Arn":"arn:aws:iam::user/test"}', stderr = '' }
|
||||
return {
|
||||
code = 0,
|
||||
stdout = '{"Account":"123456","Arn":"arn:aws:iam::user/test"}',
|
||||
stderr = '',
|
||||
}
|
||||
end
|
||||
return { code = 0, stdout = '', stderr = '' }
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue