Unverified Commit 16f2a56f authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #6339 from ipfs/fix/fail-on-plugin-failure

fail start when loading a plugin fails
parents 3316dc12 30fc5299
......@@ -60,15 +60,15 @@ func loadPlugins(repoPath string) (*loader.PluginLoader, error) {
}
plugins, err = loader.NewPluginLoader(pluginpath)
if err != nil {
log.Error("error loading plugins: ", err)
return nil, fmt.Errorf("error loading plugins: %s", err)
}
if err := plugins.Initialize(); err != nil {
log.Error("error initializing plugins: ", err)
return nil, fmt.Errorf("error initializing plugins: %s", err)
}
if err := plugins.Inject(); err != nil {
log.Error("error running plugins: ", err)
return nil, fmt.Errorf("error initializing plugins: %s", err)
}
return plugins, nil
}
......
......@@ -8,13 +8,6 @@ test_description="Test git plugin"
. lib/test-lib.sh
# if in travis CI, dont test mount (no fuse)
if ! test_have_prereq PLUGIN; then
skip_all='skipping git plugin tests, plugins not available'
test_done
fi
test_init_ipfs
# from https://github.com/ipfs/go-ipld-git/blob/master/make-test-repo.sh
......
#!/usr/bin/env bash
#
# Copyright (c) 2019 Protocol Labs
# MIT Licensed; see the LICENSE file in this repository.
#
test_description="Test plugin loading"
. lib/test-lib.sh
test_init_ipfs
test_expect_success "ipfs id succeeds" '
ipfs id
'
test_expect_success "make a bad plugin" '
mkdir -p "$IPFS_PATH/plugins" &&
echo foobar > "$IPFS_PATH/plugins/foo.so" &&
chmod +x "$IPFS_PATH/plugins/foo.so"
'
test_expect_success "ipfs id fails due to a bad plugin" '
test_expect_code 1 ipfs id
'
test_expect_success "cleanup bad plugin" '
rm "$IPFS_PATH/plugins/foo.so"
'
test_done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment