add test and remove unused funcs

Signed-off-by: Victor Vieux <vieux@docker.com>