[
https://issues.apache.org/jira/browse/GOBBLIN-1228?focusedWorklogId=468875&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-468875
]
ASF GitHub Bot logged work on GOBBLIN-1228:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 10/Aug/20 20:34
Start Date: 10/Aug/20 20:34
Worklog Time Spent: 10m
Work Description: autumnust commented on a change in pull request #3074:
URL: https://github.com/apache/incubator-gobblin/pull/3074#discussion_r468169733
##########
File path:
gobblin-yarn/src/test/java/org/apache/gobblin/yarn/GobblinYarnTestUtils.java
##########
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.yarn;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FileSystemTestHelper;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.security.Credentials;
+import org.apache.hadoop.security.token.Token;
+import org.apache.hadoop.security.token.TokenIdentifier;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+/**
+ * Utility class
+ */
+public class GobblinYarnTestUtils {
+ /**
+ * A utility method for generating a {@link
org.apache.hadoop.fs.FileSystemTestHelper.MockFileSystem} instance
+ * that can return a delegation token on {@link
org.apache.hadoop.fs.FileSystem#getDelegationToken(String)}.
+ *
+ * @param service
+ * @return
+ * @throws IOException
+ */
+ public static FileSystemTestHelper.MockFileSystem
createFileSystemForServiceName(final String service)
+ throws IOException {
+ FileSystemTestHelper.MockFileSystem mockFs = new
FileSystemTestHelper.MockFileSystem();
+ Mockito.when(mockFs.getCanonicalServiceName()).thenReturn(service);
+
Mockito.when(mockFs.getDelegationToken(Mockito.any(String.class))).thenAnswer(new
Answer<Token<?>>() {
+ int unique = 0;
+ @Override
+ public Token<?> answer(InvocationOnMock invocation) throws Throwable {
+ Token<?> token = new Token<TokenIdentifier>();
+ token.setService(new Text(service));
+ // use unique value so when we restore from token storage, we can
+ // tell if it's really the same token
+ token.setKind(new Text("token" + unique++));
+ return token;
+ }
+ });
+ return mockFs;
+ }
+
+ /**
+ * Writes a token file to a given path.
+ * @param path
+ * @param serviceName
+ * @throws IOException
+ */
+ public static void createTokenFileForService(Path path, String serviceName)
Review comment:
Should we considering calling this method as part of test to avoid
binary file (which brought in .crc as well) as part of PR ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 468875)
Time Spent: 1h 20m (was: 1h 10m)
> Do not localize token file on new TaskRunner launch
> ---------------------------------------------------
>
> Key: GOBBLIN-1228
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1228
> Project: Apache Gobblin
> Issue Type: Bug
> Components: gobblin-yarn
> Affects Versions: 0.15.0
> Reporter: Sudarshan Vasudevan
> Assignee: Abhishek Tiwari
> Priority: Major
> Fix For: 0.16.0
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> Currently, the token file is localized on each new container launch. The
> localization should happen only for AM container. Further, this task also
> provides a fix for NPE thrown in case the token file is not available
> locally.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)