Repository: allegro/marathon-consul
Pull request #128 (2016-10-06 12:52:44)

Removes unnecessary migration script
Migration script introduced in #106 is no longer necessary, as synchronization process at startup does the job now without downtime #123.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8214328/badge)](https://coveralls.io/builds/8214328)

Coverage increased (+5.008%) to 84.189% when pulling **ebf15e4b4258c5358f07f035f27890bf126f99dd on remove_1.0.0_migration_script** into **01b2f7c237022aa787026f609cf8623d96521021 on develop**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/8265327/badge)](https://coveralls.io/builds/8265327)

Coverage increased (+5.008%) to 84.189% when pulling **d65026ff9815299805c35e6fac938125e1ae8cb6 on remove_1.0.0_migration_script** into **734c9e3742932911c9200cbe247a6acbcebff6a9 on develop**.


Patch:
diff --git a/.travis.yml b/.travis.yml
index 56af8aa..27869ad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,6 @@ script:
   - go test -coverprofile=metrics.coverprofile ./metrics
   - go test -coverprofile=service.coverprofile ./service
   - go test -coverprofile=sync.coverprofile ./sync
-  - go test -coverprofile=scripts.migrate_to_marathon_task_tag.coverprofile ./scripts/migrate_to_marathon_task_tag
   - go test -coverprofile=utils.coverprofile ./utils
   - go test -coverprofile=web.coverprofile ./web
   - go test -coverprofile=main.coverprofile
diff --git a/README.md b/README.md
index 42136ab..1169d49 100644
--- a/README.md
+++ b/README.md
@@ -289,24 +289,8 @@ All registrations share the same `marathon-task` tag.
 Until 1.x.x marathon-consul would register services in Consul with registration id equal to related Marathon task id. Since 1.x.x registration ids are different and
 an additional tag, `marathon-task`, is added to each registration.
 
-If you update marathon-consul from version 0.x.x to 1.x.x, expect the synchronization phase during the first startup to reregister all services managed by marathon-consul to the new format.
-Depending on the configured healthchecks this may result in many seconds of services unavailability in the registry before their healthchecks become passing. If that's
-not acceptable for you, you should ensure that before updating marathon-consul all managed services contain a `marathon-task:<task-id>` tag, where `<task-id>` is the Marathon task id
-being registered in Consul.
-
-### Migration script
-
-You can run our migration script before updating to 1.x.x to ensure marathon-task tag in each registered service in a given datacenter.
-
-```
-migrate_to_marathon_task_tag --bootstrap-agent-location=1.2.3.4:8500
-```
-
-Provide `--bootstrap-agent-location` specifying address and port of one of the nodes in migrated datacenter. The script will discover
-all nodes in the datacenter and migrate all services registered there. Optionally, you can provide `--consul-tag` to match the one
-configured in your marathon-consul installation if you did customize it.
-
-If you have multiple datacenters you should migrate each one separately. It's safe to run the migration script multiple times – it skips services already in the new format.
+If you update marathon-consul from version 0.x.x to 1.x.x, expect the synchronization phase during the first startup to 
+reregister all healthy services managed by marathon-consul to the new format. Unhealthy services will get deregistered in the process.
 
 ## Known limitations
 
diff --git a/apps/app.go b/apps/app.go
index c143fdc..208e183 100644
--- a/apps/app.go
+++ b/apps/app.go
@@ -58,36 +58,6 @@ func (app *App) IsConsulApp() bool {
 	return ok
 }
 
-func (app *App) HasSameConsulNamesAs(other *App) bool {
-	thisNames := app.ConsulNames(".")
-	otherNames := other.ConsulNames(".")
-
-	if len(thisNames) != len(otherNames) {
-		return false
-	}
-
-	for i, name := range thisNames {
-		if name != otherNames[i] {
-			return false
-		}
-	}
-	return true
-}
-
-func (app *App) ConsulNames(separator string) []string {
-	definitions := app.findConsulPortDefinitions()
-
-	if len(definitions) == 0 {
-		return []string{app.labelsToName(app.Labels, separator)}
-	}
-
-	var names []string
-	for _, d := range definitions {
-		names = append(names, app.labelsToName(d.Labels, separator))
-	}
-	return names
-}
-
 func (app *App) labelsToRawName(labels map[string]string) string {
 	if value, ok := labels[MarathonConsulLabel]; ok && !isSpecialConsulNameValue(value) {
 		return value
diff --git a/consul/consul.go b/consul/consul.go
index 7daf44a..53539ad 100644
--- a/consul/consul.go
+++ b/consul/consul.go
@@ -270,10 +270,6 @@ func (c *Consul) deregister(toDeregister *service.Service) error {
 	return err
 }
 
-func (c *Consul) ServiceNames(app *apps.App) []string {
-	return app.ConsulNames(c.config.ConsulNameSeparator)
-}
-
 func (c *Consul) marathonTaskToConsulServices(task *apps.Task, app *apps.App) ([]*consulapi.AgentServiceRegistration, error) {
 	IP, err := utils.HostToIPv4(task.Host)
 	if err != nil {
diff --git a/consul/consul_stub.go b/consul/consul_stub.go
index 2d5dabe..681e0b1 100644
--- a/consul/consul_stub.go
+++ b/consul/consul_stub.go
@@ -125,10 +125,6 @@ func (c *Stub) RegisterOnlyFirstRegistrationIntent(task *apps.Task, app *apps.Ap
 	c.services[service.ServiceId(serviceRegistrations[0].ID)] = serviceRegistrations[0]
 }
 
-func (c *Stub) ServiceNames(app *apps.App) []string {
-	return c.consul.ServiceNames(app)
-}
-
 func (c *Stub) DeregisterByTask(taskID apps.TaskID) error {
 	c.Lock()
 	defer c.Unlock()
diff --git a/events/deployment_info.go b/events/deployment_info.go
deleted file mode 100644
index 351a0ee..0000000
--- a/events/deployment_info.go
+++ /dev/null
@@ -1,190 +0,0 @@
-package events
-
-import (
-	"encoding/json"
-	"strings"
-
-	"github.com/allegro/marathon-consul/apps"
-)
-
-type DeploymentEvent struct {
-	Type        string       `json:"eventType"`
-	Plan        *Plan        `json:"plan"`
-	CurrentStep *CurrentStep `json:"currentStep"`
-}
-
-type Plan struct {
-	Original *Deployments `json:"original"`
-	Target   *Deployments `json:"target"`
-}
-
-type Deployments struct {
-	ID     string         `json:"id"`
-	Apps   []*apps.App    `json:"apps"`
-	Groups []*Deployments `json:"groups"`
-}
-
-type CurrentStep struct {
-	Actions []*Action `json:"actions"`
-}
-
-type Action struct {
-	Type  string     `json:"type"`
-	AppID apps.AppID `json:"app"`
-}
-
-func (d *Deployments) groups() []*Deployments {
-	if d.Groups != nil {
-		return d.Groups
-	}
-	return []*Deployments{}
-}
-
-func (d *Deployments) apps() []*apps.App {
-	if d.Apps != nil {
-		return d.Apps
-	}
-	return []*apps.App{}
-}
-
-func (d *DeploymentEvent) originalDeployments() *Deployments {
-	if d.Plan != nil {
-		if d.Plan.Original != nil {
-			return d.Plan.Original
-		}
-	}
-	return &Deployments{}
-}
-
-func (d *DeploymentEvent) targetDeployments() *Deployments {
-	if d.Plan != nil {
-		if d.Plan.Target != nil {
-			return d.Plan.Target
-		}
-	}
-	return &Deployments{}
-}
-
-func (d *DeploymentEvent) actions() []*Action {
-	if d.CurrentStep != nil {
-		if d.CurrentStep.Actions != nil {
-			return d.CurrentStep.Actions
-		}
-	}
-	return []*Action{}
-}
-
-func (d *DeploymentEvent) StoppedConsulApps() []*apps.App {
-	return d.consulAppsWithActionPerformed(d.originalDeployments(), "StopApplication")
-}
-
-func (d *DeploymentEvent) RestartedConsulApps() []*apps.App {
-	return d.consulAppsWithActionPerformed(d.originalDeployments(), "RestartApplication")
-}
-
-func (d *DeploymentEvent) RenamedConsulApps() []*apps.App {
-	original := d.consulAppsWithActionPerformed(d.originalDeployments(), "RestartApplication")
-	renamedApps := []*apps.App{}
-	if len(original) > 0 {
-
-		target := d.consulAppsWithActionPerformed(d.targetDeployments(), "RestartApplication")
-		originalMap := d.appsMap(original)
-		targetMap := d.appsMap(target)
-		for id, originalApp := range originalMap {
-			targetApp, ok := targetMap[id]
-			if !ok || !originalApp.HasSameConsulNamesAs(targetApp) {
-				renamedApps = append(renamedApps, originalApp)
-			}
-		}
-	}
-	return renamedApps
-}
-
-func (d *DeploymentEvent) appsMap(applications []*apps.App) map[apps.AppID]*apps.App {
-	result := make(map[apps.AppID]*apps.App)
-	for _, app := range applications {
-		result[app.ID] = app
-	}
-	return result
-}
-
-func (d *DeploymentEvent) consulAppsWithActionPerformed(deployments *Deployments, actionType string) []*apps.App {
-	appIds := make(map[apps.AppID]struct{})
-	var exists struct{}
-
-	for _, action := range d.actions() {
-		if action.Type == actionType {
-			appIds[action.AppID] = exists
-		}
-	}
-	return d.filterConsulApps(d.findAppsInDeploymentsGroup(appIds, deployments))
-}
-
-func (d *DeploymentEvent) filterConsulApps(allApps []*apps.App) []*apps.App {
-	filtered := []*apps.App{}
-	for _, app := range allApps {
-		if app.IsConsulApp() {
-			filtered = append(filtered, app)
-		}
-	}
-	return filtered
-}
-
-func (d *DeploymentEvent) findAppsInDeploymentsGroup(appIds map[apps.AppID]struct{}, deployment *Deployments) []*apps.App {
-	foundApps := []*apps.App{}
-	filteredAppIds := deployment.filterCurrentGroupAppIds(appIds)
-	foundInCurrentGroup := d.findAppsInCurrentDeploymentGroupApps(filteredAppIds, deployment)
-	foundApps = append(foundApps, foundInCurrentGroup...)
-	foundInChildGroups := d.findAppsInDeploymentChildGroups(filteredAppIds, deployment)
-	foundApps = append(foundApps, foundInChildGroups...)
-	return foundApps
-}
-
-func (d *DeploymentEvent) findAppsInCurrentDeploymentGroupApps(appIds map[apps.AppID]struct{}, deployment *Deployments) []*apps.App {
-	foundApps := []*apps.App{}
-	searchForCount := len(appIds)
-
-	for _, app := range deployment.apps() {
-		if searchForCount < 1 {
-			break
-		}
-		if _, ok := appIds[app.ID]; ok {
-			foundApps = append(foundApps, app)
-			searchForCount--
-		}
-	}
-	return foundApps
-}
-
-func (d *DeploymentEvent) findAppsInDeploymentChildGroups(appIds map[apps.AppID]struct{}, deployment *Deployments) []*apps.App {
-	foundApps := []*apps.App{}
-	searchForCount := len(appIds)
-
-	for _, group := range deployment.groups() {
-		if searchForCount < 1 {
-			break
-		}
-		foundInChildGroup := d.findAppsInDeploymentsGroup(appIds, group)
-		foundApps = append(foundApps, foundInChildGroup...)
-		searchForCount -= len(foundInChildGroup)
-	}
-	return foundApps
-}
-
-func (d *Deployments) filterCurrentGroupAppIds(appIds map[apps.AppID]struct{}) map[apps.AppID]struct{} {
-	filteredAppIds := make(map[apps.AppID]struct{})
-	var exists struct{}
-
-	for appID := range appIds {
-		if strings.HasPrefix(appID.String(), d.ID) {
-			filteredAppIds[appID] = exists
-		}
-	}
-	return filteredAppIds
-}
-
-func ParseDeploymentEvent(jsonBlob []byte) (*DeploymentEvent, error) {
-	deploymentInfo := &DeploymentEvent{}
-	err := json.Unmarshal(jsonBlob, deploymentInfo)
-	return deploymentInfo, err
-}
diff --git a/events/deployment_info.json b/events/deployment_info.json
deleted file mode 100644
index dff3dbe..0000000
--- a/events/deployment_info.json
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "plan": {
-    "id": "25b0ad3d-28b3-4dfb-84a2-5ff19af1c467",
-    "original": {
-      "id": "/",
-      "apps": [{
-        "id": "/internalName",
-        "cmd": "python -m SimpleHTTPServer $PORT0",
-        "args": null,
-        "user": null,
-        "env": {},
-        "instances": 1,
-        "cpus": 0.1,
-        "mem": 16,
-        "disk": 0,
-        "executor": "",
-        "constraints": [],
-        "uris": [],
-        "storeUrls": [],
-        "ports": [10000],
-        "requirePorts": false,
-        "backoffSeconds": 1,
-        "backoffFactor": 1.15,
-        "maxLaunchDelaySeconds": 3600,
-        "container": null,
-        "healthChecks": [{
-          "path": "/",
-          "protocol": "HTTP",
-          "portIndex": 0,
-          "gracePeriodSeconds": 300,
-          "intervalSeconds": 60,
-          "timeoutSeconds": 20,
-          "maxConsecutiveFailures": 3,
-          "ignoreHttp1xx": false
-        }],
-        "dependencies": [],
-        "upgradeStrategy": {
-          "minimumHealthCapacity": 1,
-          "maximumOverCapacity": 1
-        },
-        "labels": {
-          "consul": "consulName"
-        },
-        "acceptedResourceRoles": null,
-        "version": "2016-01-18T12:21:04.494Z",
-        "versionInfo": {
-          "lastScalingAt": "2016-01-18T12:21:04.494Z",
-          "lastConfigChangeAt": "2016-01-18T12:21:04.494Z"
-        }
-      }],
-      "groups": [],
-      "dependencies": [],
-      "version": "2016-01-18T12:21:04.494Z"
-    },
-    "target": {
-      "id": "/",
-      "apps": [],
-      "groups": [],
-      "dependencies": [],
-      "version": "2016-01-18T12:22:07.141Z"
-    },
-    "steps": [{
-      "actions": [{
-        "type": "StopApplication",
-        "app": "/mirek"
-      }]
-    }],
-    "version": "2016-01-18T12:22:07.141Z"
-  },
-  "currentStep": {
-    "actions": [{
-      "type": "StopApplication",
-      "app": "/internalName"
-    }]
-  },
-  "eventType": "deployment_info",
-  "timestamp": "2016-01-18T12:22:07.170Z"
-}
\ No newline at end of file
diff --git a/events/deployment_step_success.json b/events/deployment_step_success.json
deleted file mode 100644
index 637559d..0000000
--- a/events/deployment_step_success.json
+++ /dev/null
@@ -1,238 +0,0 @@
-{
-  "plan": {
-    "id": "5f9e565a-d2f7-418e-bccf-161810de5672",
-    "original": {
-      "id": "/",
-      "apps": [
-        {
-          "id": "/other",
-          "cmd": "python -m SimpleHTTPServer $PORT0",
-          "args": null,
-          "user": null,
-          "env": {},
-          "instances": 2,
-          "cpus": 0.1,
-          "mem": 16,
-          "disk": 0,
-          "executor": "",
-          "constraints": [],
-          "uris": [],
-          "storeUrls": [],
-          "ports": [
-            10000
-          ],
-          "requirePorts": false,
-          "backoffSeconds": 1,
-          "backoffFactor": 1.15,
-          "maxLaunchDelaySeconds": 3600,
-          "container": null,
-          "healthChecks": [
-            {
-              "path": "/",
-              "protocol": "HTTP",
-              "portIndex": 0,
-              "gracePeriodSeconds": 300,
-              "intervalSeconds": 60,
-              "timeoutSeconds": 20,
-              "maxConsecutiveFailures": 3,
-              "ignoreHttp1xx": false
-            }
-          ],
-          "dependencies": [],
-          "upgradeStrategy": {
-            "minimumHealthCapacity": 1,
-            "maximumOverCapacity": 1
-          },
-          "labels": {
-            "consul": "true"
-          },
-          "acceptedResourceRoles": null,
-          "version": "2016-01-19T14:07:00.013Z",
-          "versionInfo": {
-            "lastScalingAt": "2016-01-19T14:07:00.013Z",
-            "lastConfigChangeAt": "2016-01-19T14:07:00.013Z"
-          }
-        },
-        {
-          "id": "/a",
-          "cmd": "python -m SimpleHTTPServer $PORT0",
-          "args": null,
-          "user": null,
-          "env": {},
-          "instances": 1,
-          "cpus": 0.1,
-          "mem": 16,
-          "disk": 0,
-          "executor": "",
-          "constraints": [],
-          "uris": [],
-          "storeUrls": [],
-          "ports": [
-            10001
-          ],
-          "requirePorts": false,
-          "backoffSeconds": 1,
-          "backoffFactor": 1.15,
-          "maxLaunchDelaySeconds": 3600,
-          "container": null,
-          "healthChecks": [
-            {
-              "path": "/",
-              "protocol": "HTTP",
-              "portIndex": 0,
-              "gracePeriodSeconds": 300,
-              "intervalSeconds": 60,
-              "timeoutSeconds": 20,
-              "maxConsecutiveFailures": 3,
-              "ignoreHttp1xx": false
-            }
-          ],
-          "dependencies": [],
-          "upgradeStrategy": {
-            "minimumHealthCapacity": 1,
-            "maximumOverCapacity": 1
-          },
-          "labels": {
-            "consul": "b"
-          },
-          "acceptedResourceRoles": null,
-          "version": "2016-01-19T14:32:43.064Z",
-          "versionInfo": {
-            "lastScalingAt": "2016-01-19T14:32:43.064Z",
-            "lastConfigChangeAt": "2016-01-19T14:32:43.064Z"
-          }
-        }
-      ],
-      "groups": [],
-      "dependencies": [],
-      "version": "2016-01-19T14:32:43.064Z"
-    },
-    "target": {
-      "id": "/",
-      "apps": [
-        {
-          "id": "/other",
-          "cmd": "python -m SimpleHTTPServer $PORT0",
-          "args": null,
-          "user": null,
-          "env": {},
-          "instances": 2,
-          "cpus": 0.1,
-          "mem": 16,
-          "disk": 0,
-          "executor": "",
-          "constraints": [],
-          "uris": [],
-          "storeUrls": [],
-          "ports": [
-            10000
-          ],
-          "requirePorts": false,
-          "backoffSeconds": 1,
-          "backoffFactor": 1.15,
-          "maxLaunchDelaySeconds": 3600,
-          "container": null,
-          "healthChecks": [
-            {
-              "path": "/",
-              "protocol": "HTTP",
-              "portIndex": 0,
-              "gracePeriodSeconds": 300,
-              "intervalSeconds": 60,
-              "timeoutSeconds": 20,
-              "maxConsecutiveFailures": 3,
-              "ignoreHttp1xx": false
-            }
-          ],
-          "dependencies": [],
-          "upgradeStrategy": {
-            "minimumHealthCapacity": 1,
-            "maximumOverCapacity": 1
-          },
-          "labels": {
-            "consul": "true"
-          },
-          "acceptedResourceRoles": null,
-          "version": "2016-01-19T14:07:00.013Z",
-          "versionInfo": {
-            "lastScalingAt": "2016-01-19T14:07:00.013Z",
-            "lastConfigChangeAt": "2016-01-19T14:07:00.013Z"
-          }
-        },
-        {
-          "id": "/a",
-          "cmd": "python -m SimpleHTTPServer $PORT0",
-          "args": null,
-          "user": null,
-          "env": {},
-          "instances": 1,
-          "cpus": 0.1,
-          "mem": 16,
-          "disk": 0,
-          "executor": "",
-          "constraints": [],
-          "uris": [],
-          "storeUrls": [],
-          "ports": [
-            10001
-          ],
-          "requirePorts": false,
-          "backoffSeconds": 1,
-          "backoffFactor": 1.15,
-          "maxLaunchDelaySeconds": 3600,
-          "container": null,
-          "healthChecks": [
-            {
-              "path": "/",
-              "protocol": "HTTP",
-              "portIndex": 0,
-              "gracePeriodSeconds": 300,
-              "intervalSeconds": 60,
-              "timeoutSeconds": 20,
-              "maxConsecutiveFailures": 3,
-              "ignoreHttp1xx": false
-            }
-          ],
-          "dependencies": [],
-          "upgradeStrategy": {
-            "minimumHealthCapacity": 1,
-            "maximumOverCapacity": 1
-          },
-          "labels": {
-            "consul": "c"
-          },
-          "acceptedResourceRoles": null,
-          "version": "2016-01-20T10:12:08.248Z",
-          "versionInfo": {
-            "lastScalingAt": "2016-01-20T10:12:08.248Z",
-            "lastConfigChangeAt": "2016-01-20T10:12:08.248Z"
-          }
-        }
-      ],
-      "groups": [],
-      "dependencies": [],
-      "version": "2016-01-20T10:12:08.248Z"
-    },
-    "steps": [
-      {
-        "actions": [
-          {
-            "type": "RestartApplication",
-            "app": "/a"
-          }
-        ]
-      }
-    ],
-    "version": "2016-01-20T10:12:08.248Z"
-  },
-  "currentStep": {
-    "actions": [
-      {
-        "type": "RestartApplication",
-        "app": "/a"
-      }
-    ]
-  },
-  "eventType": "deployment_step_success",
-  "timestamp": "2016-01-20T10:13:08.412Z"
-}
diff --git a/events/deployment_step_success_with_groups.json b/events/deployment_step_success_with_groups.json
deleted file mode 100644
index f7fd631..0000000
--- a/events/deployment_step_success_with_groups.json
+++ /dev/null
@@ -1,148 +0,0 @@
-{
-  "plan": {
-    "id": "eaeaade6-f485-4271-9058-913a885efa27",
-    "original": {
-      "id": "/",
-      "apps": [],
-      "groups": [{
-        "id": "/com.example",
-        "apps": [],
-        "groups": [{
-          "id": "/com.example/things",
-          "apps": [{
-            "id": "/com.example/things/something",
-            "cmd": "python -m SimpleHTTPServer $PORT0",
-            "args": null,
-            "user": null,
-            "env": {},
-            "instances": 1,
-            "cpus": 0.1,
-            "mem": 16,
-            "disk": 0,
-            "executor": "",
-            "constraints": [],
-            "uris": [],
-            "storeUrls": [],
-            "ports": [10000],
-            "requirePorts": false,
-            "backoffSeconds": 1,
-            "backoffFactor": 1.15,
-            "maxLaunchDelaySeconds": 3600,
-            "container": null,
-            "healthChecks": [{
-              "path": "/",
-              "protocol": "HTTP",
-              "portIndex": 0,
-              "gracePeriodSeconds": 300,
-              "intervalSeconds": 60,
-              "timeoutSeconds": 20,
-              "maxConsecutiveFailures": 3,
-              "ignoreHttp1xx": false
-            }],
-            "dependencies": [],
-            "upgradeStrategy": {
-              "minimumHealthCapacity": 1,
-              "maximumOverCapacity": 1
-            },
-            "labels": {
-              "consul": "something"
-            },
-            "acceptedResourceRoles": null,
-            "ipAddress": null,
-            "version": "2016-01-27T08:36:36.016Z",
-            "versionInfo": {
-              "lastScalingAt": "2016-01-27T08:36:36.016Z",
-              "lastConfigChangeAt": "2016-01-27T08:36:36.016Z"
-            }
-          }],
-          "groups": [],
-          "dependencies": [],
-          "version": "2016-01-27T08:36:36.016Z"
-        }],
-        "dependencies": [],
-        "version": "2016-01-27T08:36:36.016Z"
-      }],
-      "dependencies": [],
-      "version": "2016-01-27T08:36:36.016Z"
-    },
-    "target": {
-      "id": "/",
-      "apps": [],
-      "groups": [{
-        "id": "/com.example",
-        "apps": [],
-        "groups": [{
-          "id": "/com.example/things",
-          "apps": [{
-            "id": "/com.example/things/something",
-            "cmd": "python -m SimpleHTTPServer $PORT0",
-            "args": null,
-            "user": null,
-            "env": {},
-            "instances": 1,
-            "cpus": 0.1,
-            "mem": 16,
-            "disk": 0,
-            "executor": "",
-            "constraints": [],
-            "uris": [],
-            "storeUrls": [],
-            "ports": [10000],
-            "requirePorts": false,
-            "backoffSeconds": 1,
-            "backoffFactor": 1.15,
-            "maxLaunchDelaySeconds": 3600,
-            "container": null,
-            "healthChecks": [{
-              "path": "/",
-              "protocol": "HTTP",
-              "portIndex": 0,
-              "gracePeriodSeconds": 300,
-              "intervalSeconds": 60,
-              "timeoutSeconds": 20,
-              "maxConsecutiveFailures": 3,
-              "ignoreHttp1xx": false
-            }],
-            "dependencies": [],
-            "upgradeStrategy": {
-              "minimumHealthCapacity": 1,
-              "maximumOverCapacity": 1
-            },
-            "labels": {
-              "consul": "somethingDifferent"
-            },
-            "acceptedResourceRoles": null,
-            "ipAddress": null,
-            "version": "2016-01-27T08:38:43.039Z",
-            "versionInfo": {
-              "lastScalingAt": "2016-01-27T08:38:43.039Z",
-              "lastConfigChangeAt": "2016-01-27T08:38:43.039Z"
-            }
-          }],
-          "groups": [],
-          "dependencies": [],
-          "version": "2016-01-27T08:38:43.039Z"
-        }],
-        "dependencies": [],
-        "version": "2016-01-27T08:38:43.039Z"
-      }],
-      "dependencies": [],
-      "version": "2016-01-27T08:38:43.039Z"
-    },
-    "steps": [{
-      "actions": [{
-        "type": "RestartApplication",
-        "app": "/com.example/things/something"
-      }]
-    }],
-    "version": "2016-01-27T08:38:43.039Z"
-  },
-  "currentStep": {
-    "actions": [{
-      "type": "RestartApplication",
-      "app": "/com.example/things/something"
-    }]
-  },
-  "eventType": "deployment_step_success",
-  "timestamp": "2016-01-27T08:39:43.235Z"
-}
\ No newline at end of file
diff --git a/scripts/migrate_to_marathon_task_tag/main.go b/scripts/migrate_to_marathon_task_tag/main.go
deleted file mode 100644
index c176a4d..0000000
--- a/scripts/migrate_to_marathon_task_tag/main.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package main
-
-import (
-	"flag"
-	"fmt"
-	"os"
-	"strconv"
-	"strings"
-
-	log "github.com/Sirupsen/logrus"
-	"github.com/hashicorp/consul/api"
-)
-
-type Config struct {
-	BootstrapAgentLocation string
-	ConsulTag              string
-}
-
-type MigrationStats struct {
-	MigratedServices                          int
-	SkippedFailedNodes                        int
-	SkippedFailedServices                     int
-	SkippedServicesNotManagedByMarathonConsul int
-	SkippedServicesAlreadyWithMarathonTaskTag int
-}
-
-func main() {
-	config := createConfig()
-	migrateSingleDC(config.BootstrapAgentLocation, config.ConsulTag)
-}
-
-func createConfig() *Config {
-	config := &Config{}
-	flag.StringVar(&config.BootstrapAgentLocation, "bootstrap-agent-location", "127.0.0.1:8500", "Address with port to one of the agents in the migrated DC")
-	flag.StringVar(&config.ConsulTag, "consul-tag", "marathon", "Tag specifying that a service is managed by marathon-consul")
-	flag.Parse()
-	return config
-}
-
-func migrateSingleDC(bootstrapAgentLocation string, consulTag string) *MigrationStats {
-	log.WithField("BootstrapAgentLocation", bootstrapAgentLocation).WithField("Tag", consulTag).Info("Starting migration...")
-
-	agentsPort, err := extractPort(bootstrapAgentLocation)
-	if err != nil {
-		log.WithError(err).WithField("BootstrapAgentLocation", bootstrapAgentLocation).
-			Fatal("Could not extract port from agent location, aborting.")
-		os.Exit(1)
-	}
-
-	client, err := api.NewClient(&api.Config{
-		Address: bootstrapAgentLocation,
-	})
-	if err != nil {
-		log.WithError(err).WithField("BootstrapAgentLocation", bootstrapAgentLocation).
-			Fatal("Could not create client to agent, aborting.")
-		os.Exit(1)
-	}
-
-	nodes, _, err := client.Catalog().Nodes(&api.QueryOptions{})
-	if err != nil {
-		log.WithError(err).Fatal("Could not fetch nodes, aborting.")
-		os.Exit(1)
-	}
-
-	log.Infof("Discovered %d node(s) to migrate", len(nodes))
-	stats := migrateNodes(nodes, agentsPort, consulTag)
-	log.WithField("Stats", stats).Info("Migration finished")
-	return stats
-}
-
-func migrateNodes(nodes []*api.Node, agentsPort int, consulTag string) *MigrationStats {
-	stats := &MigrationStats{}
-
-	for _, node := range nodes {
-		log.WithField("Node", node.Node).Info("Migrating node...")
-		nodeAddress := fmt.Sprintf("%s:%d", node.Address, agentsPort)
-		nodeClient, err := api.NewClient(&api.Config{
-			Address: nodeAddress,
-		})
-		if err != nil {
-			log.WithError(err).WithField("Node", node.Node).WithField("Address", nodeAddress).
-				Warn("Could not create client to node, skipping")
-			stats.SkippedFailedNodes++
-			continue
-		}
-		agentServices, err := nodeClient.Agent().Services()
-		if err != nil {
-			log.WithError(err).WithField("Node", node.Node).Warn("Could not fetch services on node, skipping")
-			stats.SkippedFailedNodes++
-			continue
-		}
-
-		migrateServicesOnNode(agentServices, nodeClient, consulTag, stats)
-		log.WithField("Node", node.Node).Info("Migrated node")
-	}
-
-	return stats
-}
-
-func migrateServicesOnNode(services map[string]*api.AgentService, nodeClient *api.Client, consulTag string, stats *MigrationStats) {
-	for _, agentService := range services {
-		if !isManagedByMarathonConsul(agentService, consulTag) {
-			log.WithField("ServiceID", agentService.ID).Info("Service not managed by marathon-consul, skipping")
-			stats.SkippedServicesNotManagedByMarathonConsul++
-			continue
-		}
-		if hasMarathonTaskTag(agentService) {
-			log.WithField("ServiceID", agentService.ID).Info("Service already has marathon-task tag, skipping")
-			stats.SkippedServicesAlreadyWithMarathonTaskTag++
-			continue
-		}
-
-		if err := nodeClient.Agent().ServiceRegister(migrated(agentService)); err != nil {
-			log.WithError(err).WithField("ServiceID", agentService.ID).
-				Warn("Could not reregister service, skipping")
-			stats.SkippedFailedServices++
-			continue
-		}
-
-		log.WithField("ServiceID", agentService.ID).Info("Migrated service")
-		stats.MigratedServices++
-	}
-}
-
-func extractPort(address string) (int, error) {
-	indexOfColon := strings.LastIndex(address, ":")
-	if indexOfColon == -1 {
-		return -1, fmt.Errorf("Could not extract port from address %s, colon not found", address)
-	}
-	return strconv.Atoi(address[indexOfColon+1:])
-}
-
-func isManagedByMarathonConsul(checked *api.AgentService, consulTag string) bool {
-	for _, tag := range checked.Tags {
-		if tag == consulTag {
-			return true
-		}
-	}
-	return false
-}
-
-func hasMarathonTaskTag(checked *api.AgentService) bool {
-	for _, tag := range checked.Tags {
-		if strings.HasPrefix(tag, "marathon-task:") {
-			return true
-		}
-	}
-	return false
-}
-
-func migrated(toMigrate *api.AgentService) *api.AgentServiceRegistration {
-	tags := append(toMigrate.Tags, fmt.Sprintf("marathon-task:%s", toMigrate.ID))
-
-	return &api.AgentServiceRegistration{
-		ID:                toMigrate.ID,
-		Name:              toMigrate.Service,
-		Tags:              tags,
-		Port:              toMigrate.Port,
-		Address:           toMigrate.Address,
-		EnableTagOverride: toMigrate.EnableTagOverride,
-	}
-}
diff --git a/service/service.go b/service/service.go
index 52307e9..6a4c2a3 100644
--- a/service/service.go
+++ b/service/service.go
@@ -40,5 +40,4 @@ type ServiceRegistry interface {
 	Register(task *apps.Task, app *apps.App) error
 	DeregisterByTask(taskId apps.TaskID) error
 	Deregister(toDeregister *Service) error
-	ServiceNames(app *apps.App) []string
 }
diff --git a/web/event_handler.go b/web/event_handler.go
index 4ae16e6..23a754a 100644
--- a/web/event_handler.go
+++ b/web/event_handler.go
@@ -11,7 +11,6 @@ import (
 	"github.com/allegro/marathon-consul/marathon"
 	"github.com/allegro/marathon-consul/metrics"
 	"github.com/allegro/marathon-consul/service"
-	"github.com/allegro/marathon-consul/utils"
 )
 
 type event struct {
@@ -78,10 +77,6 @@ func (fh *eventHandler) handleEvent(eventType string, body []byte) error {
 		return fh.handleHealthStatusEvent(body)
 	case "unhealthy_task_kill_event":
 		return fh.handleUnhealthyTaskKillEvent(body)
-	case "deployment_info":
-		return fh.handleDeploymentInfo(body)
-	case "deployment_step_success":
-		return fh.handleDeploymentStepSuccess(body)
 	default:
 		log.WithField("EventType", eventType).Debug("Not handled event type")
 		return nil
@@ -179,76 +174,6 @@ func (fh *eventHandler) handleUnhealthyTaskKillEvent(body []byte) error {
 	return fh.deregister(task.ID)
 }
 
-//This handler is used when an application is stopped
-func (fh *eventHandler) handleDeploymentInfo(body []byte) error {
-	deploymentEvent, err := events.ParseDeploymentEvent(body)
-
-	if err != nil {
-		log.WithError(err).WithField("Body", body).Error("Could not parse event body")
-		return err
-	}
-
-	errors := []error{}
-	for _, app := range deploymentEvent.StoppedConsulApps() {
-		errors = append(errors, fh.deregisterAllAppServices(app)...)
-	}
-	return utils.MergeErrorsOrNil(errors, "handling deregistration")
-}
-
-//This handler is used when an application is restarted and renamed
-func (fh *eventHandler) handleDeploymentStepSuccess(body []byte) error {
-	deploymentEvent, err := events.ParseDeploymentEvent(body)
-
-	if err != nil {
-		log.WithError(err).WithField("Body", body).Error("Could not parse event body")
-		return err
-	}
-
-	errors := []error{}
-	for _, app := range deploymentEvent.RenamedConsulApps() {
-		errors = append(errors, fh.deregisterAllAppServices(app)...)
-	}
-	return utils.MergeErrorsOrNil(errors, "handling deregistration")
-}
-
-func (fh *eventHandler) deregisterAllAppServices(app *apps.App) []error {
-	errors := []error{}
-	serviceNames := fh.serviceRegistry.ServiceNames(app)
-
-	log.WithField("AppId", app.ID).WithField("ServiceNames", serviceNames).Info("Deregistering all services")
-
-	var allServices []*service.Service
-	for _, name := range serviceNames {
-		services, err := fh.serviceRegistry.GetServices(name)
-		if err != nil {
-			log.WithField("Id", app.ID).WithError(err).Error("There was a problem getting Consul services")
-			errors = append(errors, err)
-			return errors
-		}
-		allServices = append(allServices, services...)
-	}
-
-	if len(allServices) == 0 {
-		log.WithField("AppId", app.ID).WithField("ServiceNames", serviceNames).Info("No matching Consul services found")
-		return errors
-	}
-
-	for _, service := range allServices {
-		taskID, err := service.TaskId()
-		if err != nil {
-			errors = append(errors, err)
-			continue
-		}
-		if taskID.AppID() == app.ID {
-			err = fh.deregister(taskID)
-			if err != nil {
-				errors = append(errors, err)
-			}
-		}
-	}
-	return errors
-}
-
 func (fh *eventHandler) deregister(taskID apps.TaskID) error {
 	err := fh.serviceRegistry.DeregisterByTask(taskID)
 	if err != nil {


Test patch:
diff --git a/apps/app_test.go b/apps/app_test.go
index c3ec573..01987c3 100644
--- a/apps/app_test.go
+++ b/apps/app_test.go
@@ -331,191 +331,6 @@ func TestRegistrationIntent_MultipleIntentsViaPortDefinitionIfMultipleContainCon
 	assert.Equal(t, []string{"common-tag", "second-tag"}, intents[1].Tags)
 }
 
-func TestConsulNames_WithoutPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "context/app-name",
-		Labels: map[string]string{"consul": ""},
-	}
-
-	// expect
-	assert.Equal(t, []string{"context.app-name"}, app.ConsulNames("."))
-}
-
-func TestConsulNames_WithPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "context/app-name",
-		Labels: map[string]string{"consul": ""},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "some/name"},
-			},
-			{
-				Labels: map[string]string{"consul": "yet-another/name"},
-			},
-		},
-	}
-
-	// expect
-	assert.Equal(t, []string{"some.name", "yet-another.name"}, app.ConsulNames("."))
-}
-
-func TestHasSameConsulNamesAs_SameConfigsWithoutPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-	}
-
-	// expect
-	assert.True(t, app.HasSameConsulNamesAs(app))
-}
-
-func TestHasSameConsulNamesAs_DifferentConfigsSameNameWithoutPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-	}
-	other := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "app-name"},
-	}
-
-	// expect
-	assert.True(t, app.HasSameConsulNamesAs(other))
-	assert.True(t, other.HasSameConsulNamesAs(other))
-}
-
-func TestHasSameConsulNamesAs_DifferentConfigsWithoutPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "some-name"},
-	}
-	other := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "different-name"},
-	}
-
-	// expect
-	assert.False(t, app.HasSameConsulNamesAs(other))
-}
-
-func TestHasSameConsulNamesAs_SameConfigsWithPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "true"},
-			},
-		},
-	}
-
-	// expect
-	assert.True(t, app.HasSameConsulNamesAs(app))
-}
-
-func TestHasSameConsulNamesAs_DifferentConfigsSameNamesWithPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "true"},
-			},
-		},
-	}
-	other := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "app-name"},
-			},
-		},
-	}
-
-	// expect
-	assert.True(t, app.HasSameConsulNamesAs(other))
-	assert.True(t, other.HasSameConsulNamesAs(app))
-}
-
-func TestHasSameConsulNamesAs_DifferentConfigsDifferentNamesWithPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "some-name"},
-			},
-		},
-	}
-	other := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "other-name"},
-			},
-		},
-	}
-
-	// expect
-	assert.False(t, app.HasSameConsulNamesAs(other))
-}
-
-func TestHasSameConsulNamesAs_DifferentConfigsDifferentNumberOfRegitrationsWithPortDefinitions(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "some-name"},
-			},
-		},
-	}
-	other := &App{
-		ID:     "app-name",
-		Labels: map[string]string{"consul": "true"},
-		PortDefinitions: []PortDefinition{
-			{
-				Labels: map[string]string{"consul": "some-name"},
-			},
-			{
-				Labels: map[string]string{"consul": "yet-another-name"},
-			},
-		},
-	}
-
-	// expect
-	assert.False(t, app.HasSameConsulNamesAs(other))
-}
-
 func TestRegistrationIntentsNumber_NotConsulApp(t *testing.T) {
 	t.Parallel()
 
diff --git a/events/deployment_info_test.go b/events/deployment_info_test.go
deleted file mode 100644
index e6f7905..0000000
--- a/events/deployment_info_test.go
+++ /dev/null
@@ -1,393 +0,0 @@
-package events
-
-import (
-	"io/ioutil"
-	"testing"
-
-	"github.com/allegro/marathon-consul/apps"
-	"github.com/stretchr/testify/assert"
-)
-
-func TestParseDeploymentInfo(t *testing.T) {
-	t.Parallel()
-	// given
-	blob, _ := ioutil.ReadFile("deployment_info.json")
-
-	// when
-	deploymentInfo, err := ParseDeploymentEvent(blob)
-	action := deploymentInfo.actions()[0]
-	app := deploymentInfo.originalDeployments().apps()[0]
-
-	// then
-	assert.NoError(t, err)
-	assert.Equal(t, "StopApplication", action.Type)
-	assert.Equal(t, "/internalName", action.AppID.String())
-	assert.Equal(t, "/internalName", app.ID.String())
-	assert.Equal(t, "consulName", app.Labels["consul"])
-}
-
-func TestParseDeploymentStepSuccess(t *testing.T) {
-	t.Parallel()
-	// given
-	blob, _ := ioutil.ReadFile("deployment_step_success.json")
-
-	// when
-	deploymentInfo, err := ParseDeploymentEvent(blob)
-	action := deploymentInfo.actions()[0]
-	app := deploymentInfo.RestartedConsulApps()[0]
-
-	// then
-	assert.NoError(t, err)
-	assert.Equal(t, "RestartApplication", action.Type)
-	assert.Equal(t, "/a", action.AppID.String())
-	assert.Equal(t, "/a", app.ID.String())
-	assert.Equal(t, "b", app.Labels["consul"])
-}
-
-func TestParseDeploymentStepSuccessWithGroups(t *testing.T) {
-	t.Parallel()
-	// given
-	blob, _ := ioutil.ReadFile("deployment_step_success_with_groups.json")
-
-	// when
-	deploymentInfo, err := ParseDeploymentEvent(blob)
-	action := deploymentInfo.actions()[0]
-	app := deploymentInfo.RestartedConsulApps()[0]
-
-	// then
-	assert.NoError(t, err)
-	assert.Equal(t, "RestartApplication", action.Type)
-	assert.Equal(t, "/com.example/things/something", action.AppID.String())
-	assert.Equal(t, "/com.example/things/something", app.ID.String())
-	assert.Equal(t, "something", app.Labels["consul"])
-}
-
-func TestOriginalDeployments_OnEmpty(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{}
-
-	// when
-	deployments := deploymentInfo.originalDeployments()
-
-	// then
-	assert.NotNil(t, deployments)
-}
-
-func TestTargetDeployments_OnEmpty(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{}
-
-	// when
-	deployments := deploymentInfo.targetDeployments()
-
-	// then
-	assert.NotNil(t, deployments)
-}
-
-func TestActions_OnEmpty(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{}
-
-	// when
-	actions := deploymentInfo.actions()
-
-	// then
-	assert.Len(t, actions, 0)
-}
-
-func TestStoppedConsulApps(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1"},
-					{ID: "app2", Labels: map[string]string{"consul": ""}},
-					{ID: "app3", Labels: map[string]string{"consul": ""}},
-					{ID: "app4"},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "StartApplication", AppID: "app1"},
-				{Type: "StopApplication", AppID: "app2"},
-				{Type: "StopApplication", AppID: "app3"},
-				{Type: "StopApplication", AppID: "app4"},
-			},
-		},
-	}
-
-	// when
-	stoppedApps := deploymentInfo.StoppedConsulApps()
-
-	// then
-	assert.Len(t, stoppedApps, 2)
-	assert.Contains(t, stoppedApps, deploymentInfo.originalDeployments().apps()[1])
-	assert.Contains(t, stoppedApps, deploymentInfo.originalDeployments().apps()[2])
-}
-
-func TestRestartedConsulApps(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1"},
-					{ID: "app2", Labels: map[string]string{"consul": ""}},
-					{ID: "app3", Labels: map[string]string{"consul": "someName"}},
-					{ID: "app4"},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "StartApplication", AppID: "app1"},
-				{Type: "RestartApplication", AppID: "app2"},
-				{Type: "RestartApplication", AppID: "app3"},
-				{Type: "RestartApplication", AppID: "app4"},
-			},
-		},
-	}
-
-	// when
-	restartedApps := deploymentInfo.RestartedConsulApps()
-
-	// then
-	assert.Len(t, restartedApps, 2)
-	assert.Contains(t, restartedApps, deploymentInfo.originalDeployments().apps()[1])
-	assert.Contains(t, restartedApps, deploymentInfo.originalDeployments().apps()[2])
-}
-
-func TestStoppedConsulApps_NoStoppedApps(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1"},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "StartApplication", AppID: "app1"},
-			},
-		},
-	}
-
-	// when
-	stoppedApps := deploymentInfo.StoppedConsulApps()
-
-	// then
-	assert.Len(t, stoppedApps, 0)
-}
-
-func TestStoppedConsulApps_OnEmpty(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{}
-
-	// when
-	stoppedApps := deploymentInfo.StoppedConsulApps()
-
-	// then
-	assert.Len(t, stoppedApps, 0)
-}
-
-func TestRenamedConsulApps(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1", Labels: map[string]string{"consul": "same"}},
-					{ID: "app2"},
-					{ID: "app3", Labels: map[string]string{"consul": "customName"}},
-				},
-			},
-			Target: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1", Labels: map[string]string{"consul": "same"}},
-					{ID: "app2"},
-					{ID: "app3", Labels: map[string]string{"consul": "newCustomName"}},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "RestartApplication", AppID: "app1"},
-				{Type: "StartApplication", AppID: "app2"},
-				{Type: "RestartApplication", AppID: "app3"},
-			},
-		},
-	}
-
-	// when
-	renamedApps := deploymentInfo.RenamedConsulApps()
-
-	// then
-	assert.Len(t, renamedApps, 1)
-	assert.Contains(t, renamedApps, deploymentInfo.originalDeployments().apps()[2])
-}
-
-func TestRenamedConsulApps_OnEmptyPlan(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "RestartApplication", AppID: "app2"},
-				{Type: "StartApplication", AppID: "app1"},
-				{Type: "RestartApplication", AppID: "app3"},
-			},
-		},
-	}
-
-	// when
-	renamedApps := deploymentInfo.RenamedConsulApps()
-
-	// then
-	assert.Len(t, renamedApps, 0)
-}
-
-func TestRenamedConsulApps_OnConsulTrueCase(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1"},
-					{ID: "app2"},
-				},
-			},
-			Target: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1", Labels: map[string]string{"consul": "true"}},
-					{ID: "app2"},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "RestartApplication", AppID: "app1"},
-				{Type: "RestartApplication", AppID: "app2"},
-			},
-		},
-	}
-
-	// when
-	renamedApps := deploymentInfo.RenamedConsulApps()
-
-	// then
-	assert.Len(t, renamedApps, 0)
-}
-
-func TestRenamedConsulApps_OnCustomNameAdded(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1", Labels: map[string]string{"consul": ""}},
-					{ID: "app2"},
-				},
-			},
-			Target: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1", Labels: map[string]string{"consul": "customName"}},
-					{ID: "app2"},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "RestartApplication", AppID: "app1"},
-				{Type: "StartApplication", AppID: "app2"},
-			},
-		},
-	}
-
-	// when
-	renamedApps := deploymentInfo.RenamedConsulApps()
-
-	// then
-	assert.Len(t, renamedApps, 1)
-	assert.Contains(t, renamedApps, deploymentInfo.originalDeployments().apps()[0])
-}
-
-func TestRenamedConsulApps_OnCustomNameAddedToNonConsulApp(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1"},
-					{ID: "app2"},
-				},
-			},
-			Target: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1", Labels: map[string]string{"consul": "customName"}},
-					{ID: "app2"},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "RestartApplication", AppID: "app1"},
-				{Type: "StartApplication", AppID: "app2"},
-			},
-		},
-	}
-
-	// when
-	renamedApps := deploymentInfo.RenamedConsulApps()
-
-	// then
-	assert.Len(t, renamedApps, 0)
-}
-
-func TestRenamedConsulApps_OnConsulLabelRemoved(t *testing.T) {
-	t.Parallel()
-	// given
-	deploymentInfo := &DeploymentEvent{
-		Plan: &Plan{
-			Original: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1", Labels: map[string]string{"consul": "customName"}},
-					{ID: "app2"},
-				},
-			},
-			Target: &Deployments{
-				Apps: []*apps.App{
-					{ID: "app1"},
-					{ID: "app2"},
-				},
-			},
-		},
-		CurrentStep: &CurrentStep{
-			Actions: []*Action{
-				{Type: "RestartApplication", AppID: "app1"},
-				{Type: "StartApplication", AppID: "app2"},
-			},
-		},
-	}
-
-	// when
-	renamedApps := deploymentInfo.RenamedConsulApps()
-
-	// then
-	assert.Len(t, renamedApps, 1)
-	assert.Contains(t, renamedApps, deploymentInfo.originalDeployments().apps()[0])
-}
diff --git a/scripts/migrate_to_marathon_task_tag/main_test.go b/scripts/migrate_to_marathon_task_tag/main_test.go
deleted file mode 100644
index 1c3311f..0000000
--- a/scripts/migrate_to_marathon_task_tag/main_test.go
+++ /dev/null
@@ -1,127 +0,0 @@
-package main
-
-import (
-	"encoding/json"
-	"fmt"
-	"os"
-	"testing"
-
-	"github.com/allegro/marathon-consul/consul"
-	"github.com/hashicorp/consul/api"
-	"github.com/hashicorp/consul/testutil"
-	"github.com/stretchr/testify/assert"
-)
-
-func TestMigrateToMarathonTaskTag_shouldMigrateOnlyServicesWithMarathonTagAndWithoutTaskTag(t *testing.T) {
-	t.Parallel()
-	// given
-	server := consul.CreateTestServer(t)
-	defer server.Stop()
-	server.AddService("serviceA", "passing", []string{"marathon"})
-	server.AddService("serviceB-critical", "critical", []string{"marathon"})
-	server.AddService("serviceC-with-marathon-task-tag", "passing", []string{"marathon", "marathon-task:some-task"})
-	server.AddService("serviceD-without-marathon-tag", "passing", []string{})
-
-	// when
-	stats := migrateSingleDC(server.HTTPAddr, "marathon")
-
-	// then
-	client, _ := clientToServer(server)
-	services, _, _ := client.Catalog().Services(&api.QueryOptions{})
-	assert.Contains(t, services["serviceA"], "marathon-task:serviceA")
-	assert.Contains(t, services["serviceB-critical"], "marathon-task:serviceB-critical")
-	assert.NotContains(t, services["serviceC-with-marathon-task-tag"], "marathon-task:serviceC-with-marathon-task-tag")
-	assert.NotContains(t, services["serviceD-without-marathon-tag"], "marathon-task:serviceD-without-marathon-tag")
-	assert.Equal(t, 2, stats.MigratedServices)
-	assert.Equal(t, 2, stats.SkippedServicesNotManagedByMarathonConsul) // +1 for service consul
-	assert.Equal(t, 1, stats.SkippedServicesAlreadyWithMarathonTaskTag)
-}
-
-func TestMigrateToMarathonTaskTag_shouldLeaveServicePropertiesOtherThanTagsUnchanged(t *testing.T) {
-	t.Parallel()
-	// given
-	server := consul.CreateTestServer(t)
-	defer server.Stop()
-	client, _ := clientToServer(server)
-	client.Agent().ServiceRegister(&api.AgentServiceRegistration{
-		ID:      "serviceA.0",
-		Name:    "serviceA",
-		Tags:    []string{"marathon"},
-		Port:    1337,
-		Address: "1.2.3.4",
-		Check: &api.AgentServiceCheck{
-			HTTP:     "http://1.2.3.4/health",
-			Interval: "60s",
-		},
-	})
-	entriesBeforeMigration, _, _ := client.Health().Service("serviceA", "", false, &api.QueryOptions{})
-	before := entriesBeforeMigration[0]
-
-	// when
-	migrateSingleDC(server.HTTPAddr, "marathon")
-
-	// then
-	entriesAfterMigration, _, _ := client.Health().Service("serviceA", "", false, &api.QueryOptions{})
-	entryAfterMigrationAsJSON, _ := json.Marshal(entriesAfterMigration[0])
-	expectedEntryAfterMigrationAsJSON, _ := json.Marshal(&api.ServiceEntry{
-		Node:   before.Node,
-		Checks: before.Checks,
-		Service: &api.AgentService{
-			ID:                before.Service.ID,
-			Service:           before.Service.Service,
-			Tags:              []string{"marathon", fmt.Sprintf("marathon-task:%s", before.Service.ID)},
-			Port:              before.Service.Port,
-			Address:           before.Service.Address,
-			EnableTagOverride: before.Service.EnableTagOverride,
-		},
-	})
-	assert.Equal(t, string(expectedEntryAfterMigrationAsJSON), string(entryAfterMigrationAsJSON))
-}
-
-func TestMigrateToMarathonTaskTag_shouldMigrateServicesInBootstrapAgentsDCOnly(t *testing.T) {
-	t.Parallel()
-	// given
-	server := consul.CreateTestServer(t)
-	defer server.Stop()
-	serverOnOtherDC := consul.CreateTestServer(t)
-	defer serverOnOtherDC.Stop()
-	server.JoinWAN(serverOnOtherDC.WANAddr)
-
-	server.AddService("serviceA", "passing", []string{"marathon"})
-	serverOnOtherDC.AddService("serviceB", "passing", []string{"marathon"})
-
-	// when
-	migrateSingleDC(server.HTTPAddr, "marathon")
-
-	// then
-	client, _ := clientToServer(server)
-	clientToOtherDC, _ := clientToServer(serverOnOtherDC)
-	services, _, _ := client.Catalog().Services(&api.QueryOptions{})
-	servicesOnOtherDC, _, _ := clientToOtherDC.Catalog().Services(&api.QueryOptions{})
-	assert.Contains(t, services["serviceA"], "marathon-task:serviceA")
-	assert.NotContains(t, servicesOnOtherDC["serviceB"], "marathon-task:serviceC")
-}
-
-func TestMigrateToMarathonTaskTag_shouldMigrateThroughCallingMain(t *testing.T) {
-	t.Parallel()
-	// given
-	server := consul.CreateTestServer(t)
-	defer server.Stop()
-	server.AddService("serviceA", "passing", []string{"marathon"})
-	os.Args = []string{"./migrate", fmt.Sprintf("--bootstrap-agent-location=%s", server.HTTPAddr)}
-
-	// when
-	main()
-
-	//then
-	client, _ := clientToServer(server)
-	services, _, _ := client.Catalog().Services(&api.QueryOptions{})
-	assert.Contains(t, services["serviceA"], "marathon-task:serviceA")
-}
-
-func clientToServer(server *testutil.TestServer) (*api.Client, error) {
-	return api.NewClient(&api.Config{
-		Address:    server.HTTPAddr,
-		Datacenter: server.Config.Datacenter,
-	})
-}
diff --git a/sync/error_service_registry_stub_test.go b/sync/error_service_registry_stub_test.go
index 44a505d..18bfcd9 100644
--- a/sync/error_service_registry_stub_test.go
+++ b/sync/error_service_registry_stub_test.go
@@ -29,7 +29,3 @@ func (c errorServiceRegistry) DeregisterByTask(taskID apps.TaskID) error {
 func (c errorServiceRegistry) Deregister(toDeregister *service.Service) error {
 	return errors.New("Error occured")
 }
-
-func (c errorServiceRegistry) ServiceNames(app *apps.App) []string {
-	return []string{}
-}
diff --git a/sync/sync_test.go b/sync/sync_test.go
index 27cfc01..11c87b3 100644
--- a/sync/sync_test.go
+++ b/sync/sync_test.go
@@ -165,10 +165,6 @@ func (c *ConsulServicesMock) DeregisterByTask(taskID apps.TaskID) error {
 	return nil
 }
 
-func (c *ConsulServicesMock) ServiceNames(app *apps.App) []string {
-	return []string{}
-}
-
 func (c *ConsulServicesMock) Deregister(toDeregister *service.Service) error {
 	return nil
 }
diff --git a/web/event_handler_test.go b/web/event_handler_test.go
index f13e2df..3d46300 100644
--- a/web/event_handler_test.go
+++ b/web/event_handler_test.go
@@ -2,16 +2,13 @@ package web
 
 import (
 	"bytes"
-	"encoding/json"
 	"errors"
-	"fmt"
 	"net/http"
 	"net/http/httptest"
 	"testing"
 
 	"github.com/allegro/marathon-consul/apps"
 	"github.com/allegro/marathon-consul/consul"
-	"github.com/allegro/marathon-consul/events"
 	"github.com/allegro/marathon-consul/marathon"
 	. "github.com/allegro/marathon-consul/utils"
 	"github.com/stretchr/testify/assert"
@@ -135,363 +132,6 @@ func TestWebHandler_HandleAppInvalidBody(t *testing.T) {
 	assert.Equal(t, "no event\n", recorder.Body.String())
 }
 
-func TestWebHandler_HandleDeploymentInfoWithStopApplicationAction(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	app.Tasks = []apps.Task{} // tasks are not available in this event
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Empty(t, service.RegisteredTaskIDs())
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_handleDeploymentInfoWithStopApplicationForOneApp(t *testing.T) {
-	t.Parallel()
-
-	// given
-	green := ConsulApp("/test/app.green", 3)
-	green.Labels[apps.MarathonConsulLabel] = "app"
-	blue := ConsulApp("/test/app.blue", 2)
-	blue.Labels[apps.MarathonConsulLabel] = "app"
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(green, blue)
-	assert.Len(t, service.RegisteredTaskIDs(), 5)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(green))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 2)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForMultipleApps(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app1 := ConsulApp("/test/app", 3)
-	app2 := ConsulApp("/test/otherapp", 2)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app1, app2)
-	assert.Len(t, service.RegisteredTaskIDs(), 5)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app1, app2))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 0)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForMultipleAppsAndProblemsDeregisteringOne(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app1 := ConsulApp("/test/app", 3)
-	app2 := ConsulApp("/test/otherapp", 2)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app1, app2)
-	service.FailDeregisterByTaskForID("test_app.1")
-	assert.Len(t, service.RegisteredTaskIDs(), 5)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app1, app2))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 1)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionWithNoServicesRegistered(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := consul.NewConsulStub()
-	assert.Len(t, service.RegisteredTaskIDs(), 0)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 0)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentInfoWithInvalidBody(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(`{"eventType":"deployment_info", "Plan": 123}`)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForNonConsulApp(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := NonConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionForCustomServiceName(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	app.Labels["consul"] = "someCustomServiceName"
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 0)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_NotHandleDeploymentInfoWithScaleApplicationAction(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	deploymentInfo := deploymentInfoWithStopApplicationActionForApps(app)
-	deploymentInfo.CurrentStep.Actions[0].Type = "ScaleApplication"
-	body, _ := json.Marshal(deploymentInfo)
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentInfoWithStopApplicationActionAndProblemsDeregistering(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	service.FailDeregisterByTaskForID("test_app.1")
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentInfoWithStopApplicationActionForApps(app))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 1)
-	assert.False(t, marathon.Interactions())
-}
-
-func deploymentInfoWithStopApplicationActionForApps(applications ...*apps.App) *events.DeploymentEvent {
-
-	deploymentInfo := &events.DeploymentEvent{
-		Type: "deployment_info",
-		Plan: &events.Plan{
-			Original: &events.Deployments{
-				Apps: []*apps.App{},
-			},
-		},
-		CurrentStep: &events.CurrentStep{
-			Actions: []*events.Action{},
-		},
-	}
-	for _, app := range applications {
-		deploymentInfo.Plan.Original.Apps = append(deploymentInfo.Plan.Original.Apps, app)
-		deploymentInfo.CurrentStep.Actions = append(deploymentInfo.CurrentStep.Actions, &events.Action{AppID: app.ID, Type: "StopApplication"})
-	}
-	return deploymentInfo
-}
-
-func TestWebHandler_HandleDeploymentStepSuccessWithRestartAndRenameApplicationAction(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentStepSuccessWithRestartAndRenameApplicationActionForApps(app))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 0)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentStepSuccessWithInvalidBody(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app := ConsulApp("/test/app", 3)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(`{"eventType":"deployment_step_success", "Plan": 123}`)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 3)
-	assert.False(t, marathon.Interactions())
-}
-
-func TestWebHandler_HandleDeploymentStepSuccessWithRestartApplicationActionForMultipleAppsAndProblemsDeregisteringOne(t *testing.T) {
-	t.Parallel()
-
-	// given
-	app1 := ConsulApp("/test/app", 3)
-	app2 := ConsulApp("/test/otherapp", 2)
-	marathon := marathon.MarathonerStubForApps()
-	service := newConsulStubWithApplicationsTasksRegistered(app1, app2)
-	service.FailDeregisterByTaskForID("test_app.1")
-	assert.Len(t, service.RegisteredTaskIDs(), 5)
-	handle, stop := NewHandler(Config{WorkersCount: 1}, marathon, service)
-	body, _ := json.Marshal(deploymentStepSuccessWithRestartAndRenameApplicationActionForApps(app1, app2))
-	req, _ := http.NewRequest("POST", "/events", bytes.NewBuffer([]byte(body)))
-
-	// when
-	recorder := httptest.NewRecorder()
-	handle(recorder, req)
-	stop()
-
-	// then
-	assertAccepted(t, recorder)
-	assert.Len(t, service.RegisteredTaskIDs(), 1)
-	assert.False(t, marathon.Interactions())
-}
-
-func deploymentStepSuccessWithRestartAndRenameApplicationActionForApps(applications ...*apps.App) *events.DeploymentEvent {
-	deploymentInfo := &events.DeploymentEvent{
-		Type: "deployment_step_success",
-		Plan: &events.Plan{
-			Original: &events.Deployments{
-				Apps: []*apps.App{},
-			},
-			Target: &events.Deployments{
-				Apps: []*apps.App{},
-			},
-		},
-		CurrentStep: &events.CurrentStep{
-			Actions: []*events.Action{},
-		},
-	}
-	for _, app := range applications {
-		deploymentInfo.Plan.Original.Apps = append(deploymentInfo.Plan.Original.Apps, app)
-		targetApp := &apps.App{ID: app.ID, Labels: map[string]string{}}
-		if name, ok := app.Labels["consul"]; ok {
-			targetApp.Labels["consul"] = fmt.Sprintf("New%s", name)
-		}
-		deploymentInfo.Plan.Target.Apps = append(deploymentInfo.Plan.Target.Apps, targetApp)
-		deploymentInfo.CurrentStep.Actions = append(deploymentInfo.CurrentStep.Actions, &events.Action{AppID: app.ID, Type: "RestartApplication"})
-	}
-	return deploymentInfo
-}
-
 func TestWebHandler_NotHandleStatusEventWithInvalidBody(t *testing.T) {
 	t.Parallel()