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)
|
bytes[9] = bit.bor(bit.band(bytes[9], 0x3f), 0x80)
|
||||||
sync_id = string.format(
|
sync_id = string.format(
|
||||||
'%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x',
|
'%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[1],
|
||||||
bytes[5], bytes[6],
|
bytes[2],
|
||||||
bytes[7], bytes[8],
|
bytes[3],
|
||||||
bytes[9], bytes[10],
|
bytes[4],
|
||||||
bytes[11], bytes[12], bytes[13], bytes[14], bytes[15], bytes[16]
|
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._extra['_s3_sync_id'] = sync_id
|
||||||
task.modified = os.date('!%Y-%m-%dT%H:%M:%SZ') --[[@as string]]
|
task.modified = os.date('!%Y-%m-%dT%H:%M:%SZ') --[[@as string]]
|
||||||
|
|
@ -97,7 +108,9 @@ function M.auth(args)
|
||||||
else
|
else
|
||||||
log.error('s3: SSO login failed — ' .. (login_result.stderr or ''))
|
log.error('s3: SSO login failed — ' .. (login_result.stderr or ''))
|
||||||
end
|
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')
|
log.error('s3: no AWS credentials configured. See :h pending-s3')
|
||||||
else
|
else
|
||||||
log.error('s3: ' .. stderr)
|
log.error('s3: ' .. stderr)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,9 @@ describe('s3', function()
|
||||||
local task = { _extra = nil, modified = '2026-01-01T00:00:00Z' }
|
local task = { _extra = nil, modified = '2026-01-01T00:00:00Z' }
|
||||||
local id = s3._ensure_sync_id(task)
|
local id = s3._ensure_sync_id(task)
|
||||||
assert.is_not_nil(id)
|
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'])
|
assert.equals(id, task._extra['_s3_sync_id'])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -79,7 +81,11 @@ describe('s3', function()
|
||||||
it('reports success on valid credentials', function()
|
it('reports success on valid credentials', function()
|
||||||
util.system = function(args)
|
util.system = function(args)
|
||||||
if vim.tbl_contains(args, 'get-caller-identity') then
|
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
|
end
|
||||||
return { code = 0, stdout = '', stderr = '' }
|
return { code = 0, stdout = '', stderr = '' }
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue