Launchd unloading LaunchDaemon
Is the problem perhaps that your unload command hasn't finished before the load command starts?

How about trying kickstart instead? "-k" instructs launchctl to "kill the running instance before restarting the service."


  sudo launchctl kickstart -k /Library/LaunchDaemons/com.test.plist


Note that load and unload are now under "Legacy commands" in the Yosemite launchctl man page.