Search in sources :

Example 6 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class RPCNetwork method attach.

@Override
public void attach(NetworkOwner owner) {
    if (this.owner != null) {
        throw new IllegalStateException("Network is already attached to another owner.");
    }
    this.owner = owner;
    RPCSendAdapter adapter1 = new RPCSendV1();
    RPCSendAdapter adapter2 = new RPCSendV2();
    addSendAdapter(new Version(5), adapter1);
    addSendAdapter(new Version(6, 149), adapter2);
}
Also used : Version(com.yahoo.component.Version)

Example 7 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class RPCSendV1 method toParams.

protected Params toParams(Values args) {
    Params p = new Params();
    p.version = new Version(args.get(0).asUtf8Array());
    p.route = args.get(1).asString();
    p.session = args.get(2).asString();
    p.retryEnabled = (args.get(3).asInt8() != 0);
    p.retry = args.get(4).asInt32();
    p.timeRemaining = args.get(5).asInt64();
    p.protocolName = args.get(6).asUtf8Array();
    p.payload = args.get(7).asData();
    p.traceLevel = args.get(8).asInt32();
    return p;
}
Also used : Version(com.yahoo.component.Version)

Example 8 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class RPCSendV1 method createReply.

@Override
protected Reply createReply(Values ret, String serviceName, Trace trace) {
    Version version = new Version(ret.get(0).asUtf8Array());
    double retryDelay = ret.get(1).asDouble();
    int[] errorCodes = ret.get(2).asInt32Array();
    String[] errorMessages = ret.get(3).asStringArray();
    String[] errorServices = ret.get(4).asStringArray();
    Utf8Array protocolName = ret.get(5).asUtf8Array();
    byte[] payload = ret.get(6).asData();
    String replyTrace = ret.get(7).asString();
    // Make sure that the owner understands the protocol.
    Reply reply = null;
    Error error = null;
    if (payload.length > 0) {
        Object retval = decode(protocolName, version, payload);
        if (retval instanceof Reply) {
            reply = (Reply) retval;
        } else {
            error = (Error) retval;
        }
    }
    if (reply == null) {
        reply = new EmptyReply();
    }
    if (error != null) {
        reply.addError(error);
    }
    reply.setRetryDelay(retryDelay);
    for (int i = 0; i < errorCodes.length && i < errorMessages.length; i++) {
        reply.addError(new Error(errorCodes[i], errorMessages[i], errorServices[i].length() > 0 ? errorServices[i] : serviceName));
    }
    if (trace.getLevel() > 0) {
        trace.getRoot().addChild(TraceNode.decode(replyTrace));
    }
    return reply;
}
Also used : Version(com.yahoo.component.Version) Reply(com.yahoo.messagebus.Reply) EmptyReply(com.yahoo.messagebus.EmptyReply) Error(com.yahoo.messagebus.Error) Utf8Array(com.yahoo.text.Utf8Array) EmptyReply(com.yahoo.messagebus.EmptyReply)

Example 9 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class SendAdapterTestCase method requireCorrectVersionSelection.

// //////////////////////////////////////////////////////////////////////////////
// 
// Tests
// 
// //////////////////////////////////////////////////////////////////////////////
@Test
public void requireCorrectVersionSelection() {
    assertNull(srcServer.net.getSendAdapter(new Version(4, 999)));
    assertTrue(srcServer.net.getSendAdapter(new Version(5, 0)) instanceof RPCSendV1);
    assertTrue(srcServer.net.getSendAdapter(new Version(6, 148)) instanceof RPCSendV1);
    assertTrue(srcServer.net.getSendAdapter(new Version(6, 149)) instanceof RPCSendV2);
    assertTrue(srcServer.net.getSendAdapter(new Version(9, 9999)) instanceof RPCSendV2);
}
Also used : Version(com.yahoo.component.Version) Test(org.junit.Test)

Example 10 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class ApplicationApiTest method testJobStatusReporting.

@Test
public void testJobStatusReporting() throws Exception {
    ContainerControllerTester tester = new ContainerControllerTester(container, responseFiles);
    addUserToHostedOperatorRole(HostedAthenzIdentities.from(HOSTED_VESPA_OPERATOR));
    tester.containerTester().updateSystemVersion();
    long projectId = 1;
    Application app = tester.createApplication();
    ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("corp-us-east-1").build();
    // system version from mock config server client
    Version vespaVersion = new Version("6.1");
    BuildJob job = new BuildJob(report -> notifyCompletion(report, tester), tester.artifactRepository()).application(app).projectId(projectId);
    job.type(DeploymentJobs.JobType.component).uploadArtifact(applicationPackage).submit();
    tester.deploy(app, applicationPackage, TEST_ZONE, projectId);
    job.type(DeploymentJobs.JobType.systemTest).submit();
    // Notifying about unknown job fails
    Request request = request("/application/v4/tenant/tenant1/application/application1/jobreport", POST).data(asJson(job.type(DeploymentJobs.JobType.productionUsEast3).report())).userIdentity(HOSTED_VESPA_OPERATOR).get();
    tester.containerTester().assertResponse(request, new File("jobreport-unexpected-completion.json"), 400);
    // ... and assert it was recorded
    JobStatus recordedStatus = tester.controller().applications().get(app.id()).get().deploymentJobs().jobStatus().get(DeploymentJobs.JobType.component);
    assertNotNull("Status was recorded", recordedStatus);
    assertTrue(recordedStatus.isSuccess());
    assertEquals(vespaVersion, recordedStatus.lastCompleted().get().version());
    recordedStatus = tester.controller().applications().get(app.id()).get().deploymentJobs().jobStatus().get(DeploymentJobs.JobType.productionApNortheast2);
    assertNull("Status of never-triggered jobs is empty", recordedStatus);
    Response response;
    response = container.handleRequest(request("/screwdriver/v1/jobsToRun", GET).get());
    assertTrue("Response contains system-test", response.getBodyAsString().contains(DeploymentJobs.JobType.systemTest.jobName()));
    assertTrue("Response contains staging-test", response.getBodyAsString().contains(DeploymentJobs.JobType.stagingTest.jobName()));
    assertEquals("Response contains only two items", 2, SlimeUtils.jsonToSlime(response.getBody()).get().entries());
    // Check that GET didn't affect the enqueued jobs.
    response = container.handleRequest(request("/screwdriver/v1/jobsToRun", GET).get());
    assertTrue("Response contains system-test", response.getBodyAsString().contains(DeploymentJobs.JobType.systemTest.jobName()));
    assertTrue("Response contains staging-test", response.getBodyAsString().contains(DeploymentJobs.JobType.stagingTest.jobName()));
    assertEquals("Response contains only two items", 2, SlimeUtils.jsonToSlime(response.getBody()).get().entries());
}
Also used : JobStatus(com.yahoo.vespa.hosted.controller.application.JobStatus) Response(com.yahoo.application.container.handler.Response) ContainerControllerTester(com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester) Version(com.yahoo.component.Version) Request(com.yahoo.application.container.handler.Request) ApplicationPackageBuilder(com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder) BuildJob(com.yahoo.vespa.hosted.controller.deployment.BuildJob) Application(com.yahoo.vespa.hosted.controller.Application) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) File(java.io.File) ControllerContainerTest(com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest) Test(org.junit.Test)

Aggregations

Version (com.yahoo.component.Version)83 Test (org.junit.Test)46 Application (com.yahoo.vespa.hosted.controller.Application)32 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)30 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)25 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)25 DeploymentTester (com.yahoo.vespa.hosted.controller.deployment.DeploymentTester)24 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)22 ApplicationPackageBuilder (com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder)17 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)15 ApplicationId (com.yahoo.config.provision.ApplicationId)11 Collections (java.util.Collections)11 List (java.util.List)11 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)10 Optional (java.util.Optional)10 Slime (com.yahoo.slime.Slime)9 Map (java.util.Map)9 ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)7 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)7 URI (java.net.URI)7